diff options
author | Günther Deschner <gd@samba.org> | 2010-03-04 01:29:16 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-04 10:10:02 +0100 |
commit | 66b4463fc1a8c9aa0caf12765c4899ee0058a2b3 (patch) | |
tree | d379dcc4a94a35bc86d3afb48b8b9b978149eda9 /testprogs | |
parent | 6384f45f5253203ad4356dc94d2f520f310625a5 (diff) | |
download | samba-66b4463fc1a8c9aa0caf12765c4899ee0058a2b3.tar.gz samba-66b4463fc1a8c9aa0caf12765c4899ee0058a2b3.tar.xz samba-66b4463fc1a8c9aa0caf12765c4899ee0058a2b3.zip |
testprogs: add some multibyte versions of PrinterData calls.
Guenther
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/win32/spoolss/spoolss.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c index 7417b7f3219..6eea5c28525 100644 --- a/testprogs/win32/spoolss/spoolss.c +++ b/testprogs/win32/spoolss/spoolss.c @@ -1247,6 +1247,60 @@ static BOOL test_GetPrinterDataEx(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL test_GetPrinterDataExW(struct torture_context *tctx, + LPSTR servername, + LPCWSTR keyname, + LPCWSTR valuename, + HANDLE handle, + DWORD *type_p, + LPBYTE *buffer_p, + DWORD *size_p) +{ + LPBYTE buffer = NULL; + DWORD needed = 0; + DWORD type; + DWORD err = 0; + char tmp[1024]; + + torture_comment(tctx, "Testing GetPrinterDataExW(%ls - %ls)", keyname, valuename); + + err = GetPrinterDataExW(handle, keyname, valuename, &type, NULL, 0, &needed); + if (err == ERROR_MORE_DATA) { + buffer = (LPBYTE)malloc(needed); + torture_assert(tctx, buffer, "malloc failed"); + err = GetPrinterDataExW(handle, keyname, valuename, &type, buffer, needed, &needed); + } + if (err) { + sprintf(tmp, "GetPrinterDataExW(%ls) failed on [%s] (buffer size = %d), error: %s\n", + valuename, servername, needed, errstr(err)); + torture_fail(tctx, tmp); + } + + if (tctx->print) { + print_printer_dataw(keyname, valuename, needed, buffer, type); + } + + if (type_p) { + *type_p = type; + } + + if (size_p) { + *size_p = needed; + } + + if (buffer_p) { + *buffer_p = buffer; + } else { + free(buffer); + } + + return TRUE; +} + + +/**************************************************************************** +****************************************************************************/ + static BOOL test_DeletePrinterDataEx(struct torture_context *tctx, LPSTR servername, LPSTR keyname, @@ -1271,6 +1325,31 @@ static BOOL test_DeletePrinterDataEx(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL test_DeletePrinterDataExW(struct torture_context *tctx, + LPSTR servername, + LPCWSTR keyname, + LPCWSTR valuename, + HANDLE handle) +{ + DWORD err = 0; + char tmp[1024]; + + torture_comment(tctx, "Testing DeletePrinterDataExW(%ls - %ls)", keyname, valuename); + + err = DeletePrinterDataExW(handle, keyname, valuename); + if (err) { + sprintf(tmp, "DeletePrinterDataExW(%ls - %ls) failed on [%s], error: %s\n", + keyname, valuename, servername, errstr(err)); + torture_fail(tctx, tmp); + } + + return TRUE; +} + + +/**************************************************************************** +****************************************************************************/ + static BOOL test_DeletePrinterKey(struct torture_context *tctx, LPSTR servername, LPSTR keyname, @@ -1294,6 +1373,29 @@ static BOOL test_DeletePrinterKey(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL test_DeletePrinterKeyW(struct torture_context *tctx, + LPSTR servername, + LPCWSTR keyname, + HANDLE handle) +{ + DWORD err = 0; + char tmp[1024]; + + torture_comment(tctx, "Testing DeletePrinterKeyW(%ls)", keyname); + + err = DeletePrinterKeyW(handle, keyname); + if (err) { + sprintf(tmp, "DeletePrinterKeyW(%ls) failed on [%s], error: %s\n", + keyname, servername, errstr(err)); + torture_fail(tctx, tmp); + } + + return TRUE; +} + +/**************************************************************************** +****************************************************************************/ + static BOOL test_SetPrinterDataEx(struct torture_context *tctx, LPSTR servername, LPSTR keyname, @@ -1321,6 +1423,34 @@ static BOOL test_SetPrinterDataEx(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL test_SetPrinterDataExW(struct torture_context *tctx, + LPCSTR servername, + LPCWSTR keyname, + LPCWSTR valuename, + HANDLE handle, + DWORD type, + LPBYTE buffer, + DWORD offered) +{ + DWORD err = 0; + char tmp[1024]; + + torture_comment(tctx, "Testing SetPrinterDataExW(%ls - %ls)", keyname, valuename); + + err = SetPrinterDataExW(handle, keyname, valuename, type, buffer, offered); + if (err) { + sprintf(tmp, "SetPrinterDataExW(%ls) failed on [%s] (buffer size = %d), error: %s\n", + valuename, servername, offered, errstr(err)); + torture_fail(tctx, tmp); + } + + return TRUE; +} + + +/**************************************************************************** +****************************************************************************/ + static BOOL test_PrinterData_Server(struct torture_context *tctx, LPSTR servername, HANDLE handle) |