Module: wine Branch: master Commit: a851aaa4248b9f38c0c6e3b1c04e54f95de163b3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a851aaa4248b9f38c0c6e3b1c0...
Author: Pierre Schweitzer pierre@reactos.org Date: Wed Mar 25 21:18:48 2015 +0100
setupapi: Implement SetupLogErrorA(), SetupLogErrorW().
---
dlls/setupapi/misc.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/setupapi.spec | 2 +- dlls/setupapi/stubs.c | 9 ------ 3 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c index f294821..de73966 100644 --- a/dlls/setupapi/misc.c +++ b/dlls/setupapi/misc.c @@ -1679,3 +1679,75 @@ BOOL WINAPI SetupOpenLog(BOOL reserved)
return TRUE; } + +/*********************************************************************** + * SetupLogErrorA(SETUPAPI.@) + */ +BOOL WINAPI SetupLogErrorA(LPCSTR message, LogSeverity severity) +{ + static const char null[] = "(null)"; + BOOL ret; + DWORD written; + DWORD len; + + EnterCriticalSection(&setupapi_cs); + + if (setupact == INVALID_HANDLE_VALUE || setuperr == INVALID_HANDLE_VALUE) + { + SetLastError(ERROR_FILE_INVALID); + ret = FALSE; + goto done; + } + + if (message == NULL) + message = null; + + len = lstrlenA(message); + + ret = WriteFile(setupact, message, len, &written, NULL); + if (!ret) + goto done; + + if (severity >= LogSevMaximum) + { + ret = FALSE; + goto done; + } + + if (severity > LogSevInformation) + ret = WriteFile(setuperr, message, len, &written, NULL); + +done: + LeaveCriticalSection(&setupapi_cs); + return ret; +} + +/*********************************************************************** + * SetupLogErrorW(SETUPAPI.@) + */ +BOOL WINAPI SetupLogErrorW(LPCWSTR message, LogSeverity severity) +{ + LPSTR msg = NULL; + DWORD len; + BOOL ret; + + if (message) + { + len = WideCharToMultiByte(CP_ACP, 0, message, -1, NULL, 0, NULL, NULL); + msg = HeapAlloc(GetProcessHeap(), 0, len); + if (msg == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + WideCharToMultiByte(CP_ACP, 0, message, -1, msg, len, NULL, NULL); + } + + /* This is the normal way to proceed. The log files are ASCII files + * and W is to be converted. + */ + ret = SetupLogErrorA(msg, severity); + + HeapFree(GetProcessHeap(), 0, msg); + return ret; +} diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 4fcf298..c1dbed5 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -459,7 +459,7 @@ @ stdcall SetupInstallServicesFromInfSectionW(long wstr long) @ stdcall SetupIterateCabinetA(str long ptr ptr) @ stdcall SetupIterateCabinetW(wstr long ptr ptr) -@ stub SetupLogErrorA +@ stdcall SetupLogErrorA(str long) @ stdcall SetupLogErrorW(wstr long) @ stdcall SetupLogFileA(ptr str str str long str str str long) @ stdcall SetupLogFileW(ptr wstr wstr wstr long wstr wstr wstr long) diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index 66bd5d4..a57f5fe 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -189,15 +189,6 @@ BOOL WINAPI RegistryDelnode(DWORD x, DWORD y) }
/*********************************************************************** - * SetupLogErrorW(SETUPAPI.@) - */ -BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity) -{ - FIXME("(%s, %d) stub\n", debugstr_w(MessageString), Severity); - return TRUE; -} - -/*********************************************************************** * SetupPromptReboot(SETUPAPI.@) */ INT WINAPI SetupPromptReboot( HSPFILEQ file_queue, HWND owner, BOOL scan_only )