mirror of
https://github.com/reactos/reactos.git
synced 2026-06-04 10:20:48 +08:00
[NETSH] Implement MakeString and FreeString
Used by the 'winsock show catalog' command.
This commit is contained in:
@@ -273,6 +273,15 @@ FreeQuotedString(
|
||||
HeapFree(GetProcessHeap(), 0, pszQuotedString);
|
||||
}
|
||||
|
||||
VOID
|
||||
WINAPI
|
||||
FreeString(
|
||||
_In_ LPWSTR pszString)
|
||||
{
|
||||
DPRINT("FreeString(%S)\n", pszString);
|
||||
LocalFree(pszString);
|
||||
}
|
||||
|
||||
LPWSTR
|
||||
WINAPI
|
||||
MakeQuotedString(
|
||||
@@ -291,6 +300,44 @@ MakeQuotedString(
|
||||
return pszQuotedString;
|
||||
}
|
||||
|
||||
LPWSTR
|
||||
CDECL
|
||||
MakeString(
|
||||
_In_ HANDLE hModule,
|
||||
_In_ DWORD dwMsgId,
|
||||
...)
|
||||
{
|
||||
LPWSTR pszInBuffer, pszOutBuffer = NULL;
|
||||
DWORD dwLength;
|
||||
va_list ap;
|
||||
|
||||
DPRINT("MakeString(%p %lu ...)\n", hModule, dwMsgId);
|
||||
|
||||
va_start(ap, dwMsgId);
|
||||
|
||||
pszInBuffer = HeapAlloc(GetProcessHeap(), 0, HUGE_BUFFER_SIZE * sizeof(WCHAR));
|
||||
if (pszInBuffer == NULL)
|
||||
return NULL;
|
||||
|
||||
dwLength = LoadStringW(hModule, dwMsgId, pszInBuffer, HUGE_BUFFER_SIZE);
|
||||
if (dwLength > 0)
|
||||
goto done;
|
||||
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
|
||||
pszInBuffer,
|
||||
0,
|
||||
0,
|
||||
(LPWSTR)&pszOutBuffer,
|
||||
0,
|
||||
&ap);
|
||||
|
||||
done:
|
||||
if (pszInBuffer)
|
||||
HeapFree(GetProcessHeap(), 0, pszInBuffer);
|
||||
|
||||
return pszOutBuffer;
|
||||
}
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
MatchEnumTag(
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
@ stub DisplayMessageM
|
||||
@ stub DisplayMessageToConsole
|
||||
@ stdcall FreeQuotedString(wstr)
|
||||
@ stub FreeString
|
||||
@ stdcall FreeString(wstr)
|
||||
@ stub GenericMonitor
|
||||
@ stub GetEnumString
|
||||
@ stub GetHostMachineInfo
|
||||
@ stub InitializeConsole
|
||||
@ stdcall MakeQuotedString(wstr)
|
||||
@ stub MakeString
|
||||
@ varargs MakeString(ptr long)
|
||||
@ stub MatchCmdLine
|
||||
@ stdcall MatchEnumTag(ptr wstr long ptr ptr)
|
||||
@ stub MatchTagsInCmdLine
|
||||
|
||||
@@ -6,11 +6,23 @@ WINAPI
|
||||
FreeQuotedString(
|
||||
_In_ LPWSTR pszQuotedString);
|
||||
|
||||
VOID
|
||||
WINAPI
|
||||
FreeString(
|
||||
_In_ LPWSTR pszString);
|
||||
|
||||
LPWSTR
|
||||
WINAPI
|
||||
MakeQuotedString(
|
||||
_In_ LPWSTR pszString);
|
||||
|
||||
LPWSTR
|
||||
CDECL
|
||||
MakeString(
|
||||
_In_ HANDLE hModule,
|
||||
_In_ DWORD dwMsgId,
|
||||
...);
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
NsGetFriendlyNameFromIfName(
|
||||
|
||||
Reference in New Issue
Block a user