mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 03:07:05 +00:00
[NET] Load netmsg.dll right from the start and print some messages using netmsg.dll rather than local strings.
@Translators: Please start translating messages from netmsgmsg.mc and errorcodes.mc (located in sdk\include\reactos\mc). They will be used instead of local strings.
This commit is contained in:
parent
2955ed91ab
commit
d5c74ae6fe
8 changed files with 38 additions and 42 deletions
|
@ -302,7 +302,7 @@ done:
|
||||||
NetApiBufferFree(ServerInfo);
|
NetApiBufferFree(ServerInfo);
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
ConResPuts(StdOut, IDS_ERROR_NO_ERROR);
|
PrintErrorMessage(ERROR_SUCCESS);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
|
@ -255,6 +255,7 @@ cmdGroup(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PrintErrorMessage(3506/*, argv[i]*/);
|
||||||
result = 1;
|
result = 1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
INT cmdHelpMsg(INT argc, WCHAR **argv)
|
INT cmdHelpMsg(INT argc, WCHAR **argv)
|
||||||
{
|
{
|
||||||
WCHAR szBuffer[MAX_PATH];
|
|
||||||
HMODULE hMsgDll = NULL;
|
|
||||||
INT i;
|
INT i;
|
||||||
LONG errNum;
|
LONG errNum;
|
||||||
PWSTR endptr;
|
PWSTR endptr;
|
||||||
|
@ -52,20 +50,9 @@ INT cmdHelpMsg(INT argc, WCHAR **argv)
|
||||||
|
|
||||||
if (errNum >= MIN_LANMAN_MESSAGE_ID && errNum <= MAX_LANMAN_MESSAGE_ID)
|
if (errNum >= MIN_LANMAN_MESSAGE_ID && errNum <= MAX_LANMAN_MESSAGE_ID)
|
||||||
{
|
{
|
||||||
/* Load netmsg.dll */
|
|
||||||
GetSystemDirectoryW(szBuffer, ARRAYSIZE(szBuffer));
|
|
||||||
wcscat(szBuffer, L"\\netmsg.dll");
|
|
||||||
|
|
||||||
hMsgDll = LoadLibrary(szBuffer);
|
|
||||||
if (hMsgDll == NULL)
|
|
||||||
{
|
|
||||||
ConPrintf(StdOut, L"Failed to load netmsg.dll\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
||||||
FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
||||||
hMsgDll,
|
hModuleNetMsg,
|
||||||
errNum,
|
errNum,
|
||||||
LANG_USER_DEFAULT,
|
LANG_USER_DEFAULT,
|
||||||
(LPWSTR)&pBuffer,
|
(LPWSTR)&pBuffer,
|
||||||
|
@ -80,8 +67,6 @@ INT cmdHelpMsg(INT argc, WCHAR **argv)
|
||||||
{
|
{
|
||||||
PrintErrorMessage(3871);
|
PrintErrorMessage(3871);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(hMsgDll);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -275,6 +275,7 @@ cmdLocalGroup(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PrintErrorMessage(3506/*, argv[i]*/);
|
||||||
result = 1;
|
result = 1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ cmdStatistics(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
ConResPuts(StdOut, IDS_ERROR_NO_ERROR);
|
PrintErrorMessage(ERROR_SUCCESS);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
|
@ -109,7 +109,7 @@ cmdUse(
|
||||||
{
|
{
|
||||||
Status = EnumerateConnections(NULL);
|
Status = EnumerateConnections(NULL);
|
||||||
if (Status == NO_ERROR)
|
if (Status == NO_ERROR)
|
||||||
ConResPrintf(StdOut, IDS_ERROR_NO_ERROR);
|
PrintErrorMessage(ERROR_SUCCESS);
|
||||||
else
|
else
|
||||||
PrintError(Status);
|
PrintError(Status);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ cmdUse(
|
||||||
|
|
||||||
Status = EnumerateConnections(argv[2]);
|
Status = EnumerateConnections(argv[2]);
|
||||||
if (Status == NO_ERROR)
|
if (Status == NO_ERROR)
|
||||||
ConResPrintf(StdOut, IDS_ERROR_NO_ERROR);
|
PrintErrorMessage(ERROR_SUCCESS);
|
||||||
else
|
else
|
||||||
PrintError(Status);
|
PrintError(Status);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ COMMAND cmds[] =
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HMODULE hModuleNetMsg = NULL;
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -80,28 +81,15 @@ VOID
|
||||||
PrintErrorMessage(
|
PrintErrorMessage(
|
||||||
DWORD dwError)
|
DWORD dwError)
|
||||||
{
|
{
|
||||||
WCHAR szDllBuffer[MAX_PATH];
|
|
||||||
WCHAR szErrorBuffer[16];
|
WCHAR szErrorBuffer[16];
|
||||||
HMODULE hMsgDll = NULL;
|
|
||||||
PWSTR pBuffer;
|
PWSTR pBuffer;
|
||||||
PWSTR pErrorInserts[2] = {NULL, NULL};
|
PWSTR pErrorInserts[2] = {NULL, NULL};
|
||||||
|
|
||||||
/* Load netmsg.dll */
|
|
||||||
GetSystemDirectoryW(szDllBuffer, ARRAYSIZE(szDllBuffer));
|
|
||||||
wcscat(szDllBuffer, L"\\netmsg.dll");
|
|
||||||
|
|
||||||
hMsgDll = LoadLibrary(szDllBuffer);
|
|
||||||
if (hMsgDll == NULL)
|
|
||||||
{
|
|
||||||
ConPrintf(StdErr, L"Failed to load netmsg.dll\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwError >= MIN_LANMAN_MESSAGE_ID && dwError <= MAX_LANMAN_MESSAGE_ID)
|
if (dwError >= MIN_LANMAN_MESSAGE_ID && dwError <= MAX_LANMAN_MESSAGE_ID)
|
||||||
{
|
{
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
||||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
hMsgDll,
|
hModuleNetMsg,
|
||||||
dwError,
|
dwError,
|
||||||
LANG_USER_DEFAULT,
|
LANG_USER_DEFAULT,
|
||||||
(LPWSTR)&pBuffer,
|
(LPWSTR)&pBuffer,
|
||||||
|
@ -141,7 +129,7 @@ PrintErrorMessage(
|
||||||
/* Format and print the 3514 message */
|
/* Format and print the 3514 message */
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
|
||||||
FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
FORMAT_MESSAGE_ARGUMENT_ARRAY,
|
||||||
hMsgDll,
|
hModuleNetMsg,
|
||||||
3514,
|
3514,
|
||||||
LANG_USER_DEFAULT,
|
LANG_USER_DEFAULT,
|
||||||
(LPWSTR)&pBuffer,
|
(LPWSTR)&pBuffer,
|
||||||
|
@ -154,8 +142,6 @@ PrintErrorMessage(
|
||||||
pBuffer = NULL;
|
pBuffer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(hMsgDll);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,15 +184,29 @@ ReadFromConsole(
|
||||||
|
|
||||||
int wmain(int argc, WCHAR **argv)
|
int wmain(int argc, WCHAR **argv)
|
||||||
{
|
{
|
||||||
|
WCHAR szDllBuffer[MAX_PATH];
|
||||||
PCOMMAND cmdptr;
|
PCOMMAND cmdptr;
|
||||||
|
int nResult = 0;
|
||||||
|
BOOL bRun = FALSE;
|
||||||
|
|
||||||
/* Initialize the Console Standard Streams */
|
/* Initialize the Console Standard Streams */
|
||||||
ConInitStdStreams();
|
ConInitStdStreams();
|
||||||
|
|
||||||
|
/* Load netmsg.dll */
|
||||||
|
GetSystemDirectoryW(szDllBuffer, ARRAYSIZE(szDllBuffer));
|
||||||
|
wcscat(szDllBuffer, L"\\netmsg.dll");
|
||||||
|
|
||||||
|
hModuleNetMsg = LoadLibrary(szDllBuffer);
|
||||||
|
if (hModuleNetMsg == NULL)
|
||||||
|
{
|
||||||
|
ConPrintf(StdErr, L"Failed to load netmsg.dll\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
ConResPuts(StdOut, IDS_NET_SYNTAX);
|
nResult = 1;
|
||||||
return 1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan the command table */
|
/* Scan the command table */
|
||||||
|
@ -214,13 +214,20 @@ int wmain(int argc, WCHAR **argv)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(argv[1], cmdptr->name) == 0)
|
if (_wcsicmp(argv[1], cmdptr->name) == 0)
|
||||||
{
|
{
|
||||||
return cmdptr->func(argc, argv);
|
nResult = cmdptr->func(argc, argv);
|
||||||
|
bRun = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConResPuts(StdOut, IDS_NET_SYNTAX);
|
done:
|
||||||
|
if (bRun == FALSE)
|
||||||
|
ConResPuts(StdOut, IDS_NET_SYNTAX);
|
||||||
|
|
||||||
return 1;
|
if (hModuleNetMsg != NULL)
|
||||||
|
FreeLibrary(hModuleNetMsg);
|
||||||
|
|
||||||
|
return nResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT unimplemented(INT argc, WCHAR **argv)
|
INT unimplemented(INT argc, WCHAR **argv)
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
extern HMODULE hModuleNetMsg;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PrintPaddedResourceString(
|
PrintPaddedResourceString(
|
||||||
UINT uID,
|
UINT uID,
|
||||||
|
|
Loading…
Reference in a new issue