Commit 152b2401 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ntprint: PSetupCreateMonitorInfo() takes two arguments, the second is a server name.

parent a0e73a1f
......@@ -65,18 +65,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
*
*/
HANDLE WINAPI PSetupCreateMonitorInfo(LPVOID unknown1, LPVOID unknown2,LPVOID unknown3)
HANDLE WINAPI PSetupCreateMonitorInfo(DWORD unknown1, WCHAR *server)
{
monitorinfo_t * mi=NULL;
DWORD needed;
DWORD res;
TRACE("(%p, %p, %p)\n", unknown1, unknown2, unknown3);
if ((unknown2 != NULL) || (unknown3 != NULL)) {
FIXME("got unknown parameter: (%p, %p, %p)\n", unknown1, unknown2, unknown3);
return NULL;
}
TRACE("(%d, %s)\n", unknown1, debugstr_w(server));
mi = HeapAlloc(GetProcessHeap(), 0, sizeof(monitorinfo_t));
if (!mi) {
......@@ -85,15 +80,14 @@ HANDLE WINAPI PSetupCreateMonitorInfo(LPVOID unknown1, LPVOID unknown2,LPVOID u
}
/* Get the needed size for all Monitors */
res = EnumMonitorsW(NULL, 2, NULL, 0, &needed, &mi->installed);
res = EnumMonitorsW(server, 2, NULL, 0, &needed, &mi->installed);
if (!res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {
mi->mi2 = HeapAlloc(GetProcessHeap(), 0, needed);
res = EnumMonitorsW(NULL, 2, (LPBYTE) mi->mi2, needed, &needed, &mi->installed);
res = EnumMonitorsW(server, 2, (LPBYTE) mi->mi2, needed, &needed, &mi->installed);
}
if (!res) {
HeapFree(GetProcessHeap(), 0, mi);
/* FIXME: SetLastError() needed? */
return NULL;
}
......
......@@ -2,7 +2,7 @@
@ stub PSetupAssociateICMProfiles
@ stub PSetupBuildDriversFromPath
@ stub PSetupCreateDrvSetupPage
@ stdcall PSetupCreateMonitorInfo(long ptr ptr)
@ stdcall PSetupCreateMonitorInfo(long wstr)
@ stub PSetupCreatePrinterDeviceInfoList
@ stub PSetupDestroyDriverInfo3
@ stdcall PSetupDestroyMonitorInfo(long)
......
......@@ -32,7 +32,7 @@
/* ##### */
static HMODULE hdll;
static HANDLE (WINAPI *pPSetupCreateMonitorInfo)(LPVOID, LPVOID, LPVOID);
static HANDLE (WINAPI *pPSetupCreateMonitorInfo)(DWORD, const WCHAR *);
static VOID (WINAPI *pPSetupDestroyMonitorInfo)(HANDLE);
static BOOL (WINAPI *pPSetupEnumMonitor)(HANDLE, DWORD, LPWSTR, LPDWORD);
......@@ -66,10 +66,12 @@ static LPCSTR load_functions(void)
static void test_PSetupCreateMonitorInfo(VOID)
{
HANDLE mi;
BYTE buffer[1024] ;
WCHAR buffer[1024] = {'\\','\\'};
UINT len = sizeof(buffer) / sizeof(buffer[0]) - 2;
GetComputerNameW(buffer + 2, &len);
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL);
mi = pPSetupCreateMonitorInfo(0, NULL);
if (!mi && (GetLastError() == RPC_S_SERVER_UNAVAILABLE)) {
win_skip("The service 'Spooler' is required for many tests\n");
return;
......@@ -77,13 +79,18 @@ static void test_PSetupCreateMonitorInfo(VOID)
ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError());
if (mi) pPSetupDestroyMonitorInfo(mi);
memset(buffer, 0, sizeof(buffer));
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(buffer, NULL, NULL);
mi = pPSetupCreateMonitorInfo(0, buffer);
ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError());
if (mi) pPSetupDestroyMonitorInfo(mi);
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(0, buffer + 1);
todo_wine {
ok( mi == NULL, "got %p\n", mi );
ok( GetLastError() == ERROR_INVALID_NAME, "got %d\n", GetLastError() );
}
if (mi) pPSetupDestroyMonitorInfo(mi);
}
/* ########################### */
......@@ -99,7 +106,7 @@ static void test_PSetupDestroyMonitorInfo(VOID)
trace("returned with %u\n", GetLastError());
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL);
mi = pPSetupCreateMonitorInfo(0, NULL);
if (!mi && (GetLastError() == RPC_S_SERVER_UNAVAILABLE)) {
win_skip("The service 'Spooler' is required for many tests\n");
return;
......@@ -134,7 +141,7 @@ static void test_PSetupEnumMonitor(VOID)
DWORD index=0;
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL);
mi = pPSetupCreateMonitorInfo(0, NULL);
if (!mi) {
skip("PSetupCreateMonitorInfo\n");
return;
......
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