From f6e1dbf77169c70a6bc994912c81845b00cd62b4 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Fri, 22 Jun 2007 00:31:29 +0200 Subject: [PATCH] ntprint: Implement PSetupEnumMonitor. --- dlls/ntprint/ntprint.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ntprint/ntprint.spec | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/dlls/ntprint/ntprint.c b/dlls/ntprint/ntprint.c index 7363b9c5dfe..ece26effb69 100644 --- a/dlls/ntprint/ntprint.c +++ b/dlls/ntprint/ntprint.c @@ -120,3 +120,48 @@ VOID WINAPI PSetupDestroyMonitorInfo(HANDLE monitorinfo) HeapFree(GetProcessHeap(), 0, mi); } } + +/***************************************************** + * PSetupEnumMonitor [NTPRINT.@] + * + * Copy the selected Monitorname to a buffer + * + * PARAMS + * monitorinfo [I] HANDLE from PSetupCreateMonitorInfo + * index [I] Nr. of the Monitorname to copy + * buffer [I] Target, that receive the Monitorname + * psize [IO] PTR to a DWORD that hold the size of the buffer and receive + * the needed size, when the buffer is to small + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * NOTES + * size is in Bytes on w2k and WCHAR on XP + * + */ + +BOOL WINAPI PSetupEnumMonitor(HANDLE monitorinfo, DWORD index, LPWSTR buffer, LPDWORD psize) +{ + monitorinfo_t * mi = (monitorinfo_t *) monitorinfo; + LPWSTR nameW; + DWORD len; + + TRACE("(%p, %u, %p, %p) => %d\n", mi, index, buffer, psize, psize ? *psize : 0); + + if (index < mi->installed) { + nameW = mi->mi2[index].pName; + len = lstrlenW(nameW) + 1; + if (len <= *psize) { + memcpy(buffer, nameW, len * sizeof(WCHAR)); + TRACE("#%u: %s\n", index, debugstr_w(buffer)); + return TRUE; + } + *psize = len; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + SetLastError(ERROR_NO_MORE_ITEMS); + return FALSE; +} diff --git a/dlls/ntprint/ntprint.spec b/dlls/ntprint/ntprint.spec index 348ab697a75..88697760534 100644 --- a/dlls/ntprint/ntprint.spec +++ b/dlls/ntprint/ntprint.spec @@ -9,7 +9,7 @@ @ stub PSetupDestroyPrinterDeviceInfoList @ stub PSetupDestroySelectedDriverInfo @ stub PSetupDriverInfoFromName -@ stub PSetupEnumMonitor +@ stdcall PSetupEnumMonitor(long long ptr ptr) @ stub PSetupFreeDrvField @ stub PSetupGetDriverInfForPrinter @ stub PSetupGetDriverInfo3 -- 2.11.4.GIT