Commit a851aaa4 authored by Pierre Schweitzer's avatar Pierre Schweitzer Committed by Alexandre Julliard

setupapi: Implement SetupLogErrorA(), SetupLogErrorW().

parent 799dfa6a
......@@ -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;
}
......@@ -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)
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment