mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 09:11:42 +00:00
[REACTOS] Fix 64 bit issues
This commit is contained in:
parent
0f8439aa71
commit
cf77354dce
11 changed files with 36 additions and 26 deletions
|
@ -70,20 +70,20 @@ LogToFile(LPCWSTR lpMsg,
|
|||
UINT flags)
|
||||
{
|
||||
LPWSTR lpFullMsg = NULL;
|
||||
DWORD msgLen;
|
||||
SIZE_T msgLen;
|
||||
|
||||
msgLen = wcslen(lpMsg) + 1;
|
||||
|
||||
if (flags & LOG_ERROR)
|
||||
{
|
||||
LPVOID lpSysMsg;
|
||||
LPWSTR lpSysMsg;
|
||||
DWORD eMsgLen;
|
||||
|
||||
eMsgLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
errNum,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&lpSysMsg,
|
||||
(LPWSTR)&lpSysMsg,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
|
@ -122,6 +122,13 @@ LogToFile(LPCWSTR lpMsg,
|
|||
}
|
||||
}
|
||||
|
||||
/* Make sure the length in bytes doesn't overflow a DWORD */
|
||||
msgLen = wcslen(lpFullMsg);
|
||||
if (msgLen > (MAXDWORD / sizeof(WCHAR)))
|
||||
{
|
||||
RaiseException(EXCEPTION_INT_OVERFLOW, 0, 0, NULL);
|
||||
}
|
||||
|
||||
if (lpFullMsg)
|
||||
{
|
||||
DWORD bytesWritten;
|
||||
|
@ -130,7 +137,7 @@ LogToFile(LPCWSTR lpMsg,
|
|||
|
||||
bRet = WriteFile(hLogFile,
|
||||
lpFullMsg,
|
||||
wcslen(lpFullMsg) * sizeof(WCHAR),
|
||||
(DWORD)msgLen * sizeof(WCHAR),
|
||||
&bytesWritten,
|
||||
&olWrite);
|
||||
if (!bRet)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue