spoolss/tests: Add tests for SplInitializeWinSpoolDrv.
This commit is contained in:
parent
a2b70095f6
commit
cf122bab8c
|
@ -437,6 +437,9 @@ dlls/snmpapi/tests/snmpapi_crosstest.exe
|
|||
dlls/snmpapi/tests/testlist.c
|
||||
dlls/sound.drv16
|
||||
dlls/spoolss/libspoolss.def
|
||||
dlls/spoolss/tests/*.ok
|
||||
dlls/spoolss/tests/spoolss_crosstest.exe
|
||||
dlls/spoolss/tests/testlist.c
|
||||
dlls/stdole2.tlb/rsrc.res
|
||||
dlls/stdole2.tlb/std_ole_v2.tlb
|
||||
dlls/stdole32.tlb/rsrc.res
|
||||
|
@ -728,6 +731,7 @@ programs/winetest/shdocvw_test.exe
|
|||
programs/winetest/shell32_test.exe
|
||||
programs/winetest/shlwapi_test.exe
|
||||
programs/winetest/snmpapi_test.exe
|
||||
programs/winetest/spoolss_test.exe
|
||||
programs/winetest/urlmon_test.exe
|
||||
programs/winetest/user32_test.exe
|
||||
programs/winetest/usp10_test.exe
|
||||
|
|
|
@ -385,6 +385,7 @@ ALL_MAKEFILES = \
|
|||
dlls/snmpapi/Makefile \
|
||||
dlls/snmpapi/tests/Makefile \
|
||||
dlls/spoolss/Makefile \
|
||||
dlls/spoolss/tests/Makefile \
|
||||
dlls/stdole2.tlb/Makefile \
|
||||
dlls/stdole32.tlb/Makefile \
|
||||
dlls/sti/Makefile \
|
||||
|
@ -754,6 +755,7 @@ dlls/shlwapi/tests/Makefile: dlls/shlwapi/tests/Makefile.in dlls/Maketest.rules
|
|||
dlls/snmpapi/Makefile: dlls/snmpapi/Makefile.in dlls/Makedll.rules
|
||||
dlls/snmpapi/tests/Makefile: dlls/snmpapi/tests/Makefile.in dlls/Maketest.rules
|
||||
dlls/spoolss/Makefile: dlls/spoolss/Makefile.in dlls/Makedll.rules
|
||||
dlls/spoolss/tests/Makefile: dlls/spoolss/tests/Makefile.in dlls/Maketest.rules
|
||||
dlls/stdole2.tlb/Makefile: dlls/stdole2.tlb/Makefile.in dlls/Makedll.rules
|
||||
dlls/stdole32.tlb/Makefile: dlls/stdole32.tlb/Makefile.in dlls/Makedll.rules
|
||||
dlls/sti/Makefile: dlls/sti/Makefile.in dlls/Makedll.rules
|
||||
|
|
|
@ -20726,6 +20726,8 @@ ac_config_files="$ac_config_files dlls/snmpapi/tests/Makefile"
|
|||
|
||||
ac_config_files="$ac_config_files dlls/spoolss/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files dlls/spoolss/tests/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files dlls/stdole2.tlb/Makefile"
|
||||
|
||||
ac_config_files="$ac_config_files dlls/stdole32.tlb/Makefile"
|
||||
|
@ -21773,6 +21775,7 @@ do
|
|||
"dlls/snmpapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/snmpapi/Makefile" ;;
|
||||
"dlls/snmpapi/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/snmpapi/tests/Makefile" ;;
|
||||
"dlls/spoolss/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/spoolss/Makefile" ;;
|
||||
"dlls/spoolss/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/spoolss/tests/Makefile" ;;
|
||||
"dlls/stdole2.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole2.tlb/Makefile" ;;
|
||||
"dlls/stdole32.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole32.tlb/Makefile" ;;
|
||||
"dlls/sti/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/Makefile" ;;
|
||||
|
|
|
@ -1783,6 +1783,7 @@ AC_CONFIG_FILES([dlls/shlwapi/tests/Makefile])
|
|||
AC_CONFIG_FILES([dlls/snmpapi/Makefile])
|
||||
AC_CONFIG_FILES([dlls/snmpapi/tests/Makefile])
|
||||
AC_CONFIG_FILES([dlls/spoolss/Makefile])
|
||||
AC_CONFIG_FILES([dlls/spoolss/tests/Makefile])
|
||||
AC_CONFIG_FILES([dlls/stdole2.tlb/Makefile])
|
||||
AC_CONFIG_FILES([dlls/stdole32.tlb/Makefile])
|
||||
AC_CONFIG_FILES([dlls/sti/Makefile])
|
||||
|
|
|
@ -299,6 +299,7 @@ TESTSUBDIRS = \
|
|||
shell32/tests \
|
||||
shlwapi/tests \
|
||||
snmpapi/tests \
|
||||
spoolss/tests \
|
||||
urlmon/tests \
|
||||
user32/tests \
|
||||
usp10/tests \
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
TOPSRCDIR = @top_srcdir@
|
||||
TOPOBJDIR = ../../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
TESTDLL = spoolss.dll
|
||||
IMPORTS = kernel32
|
||||
|
||||
CTESTS = \
|
||||
spoolss.c
|
||||
|
||||
@MAKE_TEST_RULES@
|
||||
|
||||
@DEPENDENCIES@ # everything below this line is overwritten by make depend
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Unit test suite for the Spooler-Service helper DLL
|
||||
*
|
||||
* Copyright 2007 Detlef Riekenberg
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
|
||||
|
||||
/* ##### */
|
||||
|
||||
static HMODULE hwinspool;
|
||||
|
||||
static HMODULE hspl;
|
||||
static DWORD (WINAPI * pSplInitializeWinSpoolDrv)(LPVOID *);
|
||||
|
||||
#define WINSPOOL_TABLESIZE 16
|
||||
|
||||
static LPVOID fn_spl[WINSPOOL_TABLESIZE];
|
||||
static LPVOID fn_w2k[WINSPOOL_TABLESIZE];
|
||||
static LPVOID fn_xp[WINSPOOL_TABLESIZE];
|
||||
|
||||
/* ########################### */
|
||||
|
||||
static LPCSTR load_functions(void)
|
||||
{
|
||||
LPCSTR ptr;
|
||||
|
||||
ptr = "spoolss.dll";
|
||||
hspl = LoadLibraryA(ptr);
|
||||
if (!hspl) return ptr;
|
||||
|
||||
ptr = "SplInitializeWinSpoolDrv";
|
||||
pSplInitializeWinSpoolDrv = (void *) GetProcAddress(hspl, ptr);
|
||||
if (!pSplInitializeWinSpoolDrv) return ptr;
|
||||
|
||||
|
||||
ptr = "winspool.drv";
|
||||
hwinspool = LoadLibraryA(ptr);
|
||||
if (!hwinspool) return ptr;
|
||||
|
||||
memset(fn_w2k, 0xff, sizeof(fn_w2k));
|
||||
fn_w2k[0] = (void *) GetProcAddress(hwinspool, "OpenPrinterW");
|
||||
fn_w2k[1] = (void *) GetProcAddress(hwinspool, "ClosePrinter");
|
||||
fn_w2k[2] = (void *) GetProcAddress(hwinspool, "SpoolerDevQueryPrintW");
|
||||
fn_w2k[3] = (void *) GetProcAddress(hwinspool, "SpoolerPrinterEvent");
|
||||
fn_w2k[4] = (void *) GetProcAddress(hwinspool, "DocumentPropertiesW");
|
||||
fn_w2k[5] = (void *) GetProcAddress(hwinspool, (LPSTR) 212); /* LoadPrinterDriver */
|
||||
fn_w2k[6] = (void *) GetProcAddress(hwinspool, "SetDefaultPrinterW");
|
||||
fn_w2k[7] = (void *) GetProcAddress(hwinspool, "GetDefaultPrinterW");
|
||||
fn_w2k[8] = (void *) GetProcAddress(hwinspool, (LPSTR) 213); /* RefCntLoadDriver */
|
||||
fn_w2k[9] = (void *) GetProcAddress(hwinspool, (LPSTR) 214); /* RefCntUnloadDriver */
|
||||
fn_w2k[10] = (void *) GetProcAddress(hwinspool, (LPSTR) 215); /* ForceUnloadDriver */
|
||||
|
||||
memset(fn_xp, 0xff, sizeof(fn_xp));
|
||||
fn_xp[0] = (void *) GetProcAddress(hwinspool, "OpenPrinterW");
|
||||
fn_xp[1] = (void *) GetProcAddress(hwinspool, "ClosePrinter");
|
||||
fn_xp[2] = (void *) GetProcAddress(hwinspool, "SpoolerDevQueryPrintW");
|
||||
fn_xp[3] = (void *) GetProcAddress(hwinspool, "SpoolerPrinterEvent");
|
||||
fn_xp[4] = (void *) GetProcAddress(hwinspool, "DocumentPropertiesW");
|
||||
fn_xp[5] = (void *) GetProcAddress(hwinspool, (LPSTR) 212); /* LoadPrinterDriver */
|
||||
fn_xp[6] = (void *) GetProcAddress(hwinspool, (LPSTR) 213); /* RefCntLoadDriver */
|
||||
fn_xp[7] = (void *) GetProcAddress(hwinspool, (LPSTR) 214); /* RefCntUnloadDriver */
|
||||
fn_xp[8] = (void *) GetProcAddress(hwinspool, (LPSTR) 215); /* ForceUnloadDriver */
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
||||
static void test_SplInitializeWinSpoolDrv(VOID)
|
||||
{
|
||||
DWORD res;
|
||||
LONG id;
|
||||
BOOL is_xp;
|
||||
|
||||
memset(fn_spl, 0xff, sizeof(fn_spl));
|
||||
SetLastError(0xdeadbeef);
|
||||
res = pSplInitializeWinSpoolDrv(fn_spl);
|
||||
ok(res, "got %u with %u (expected '!= 0')\n", res, GetLastError());
|
||||
|
||||
/* functions 0 to 5 are the same with "spoolss.dll" from w2k and xp */
|
||||
is_xp = (fn_spl[6] == fn_xp[6]);
|
||||
id = 0;
|
||||
while (id < WINSPOOL_TABLESIZE) {
|
||||
ok( fn_spl[id] == (is_xp ? fn_xp[id] : fn_w2k[id]),
|
||||
"(#%02u) spoolss: %p, xp: %p, w2k: %p\n", id, fn_spl[id], fn_xp[id], fn_w2k[id]);
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
||||
START_TEST(spoolss)
|
||||
{
|
||||
LPCSTR ptr;
|
||||
|
||||
/* spoolss.dll does not exist on win9x */
|
||||
ptr = load_functions();
|
||||
if (ptr) {
|
||||
skip("%s not found\n", ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
test_SplInitializeWinSpoolDrv();
|
||||
|
||||
}
|
|
@ -77,6 +77,7 @@ TESTBINS = \
|
|||
shell32_test.exe \
|
||||
shlwapi_test.exe \
|
||||
snmpapi_test.exe \
|
||||
spoolss_test.exe \
|
||||
urlmon_test.exe \
|
||||
user32_test.exe \
|
||||
usp10_test.exe \
|
||||
|
@ -202,6 +203,8 @@ shlwapi_test.exe: $(DLLDIR)/shlwapi/tests/shlwapi_test.exe$(DLLEXT)
|
|||
cp $(DLLDIR)/shlwapi/tests/shlwapi_test.exe$(DLLEXT) $@ && $(STRIP) $@
|
||||
snmpapi_test.exe: $(DLLDIR)/snmpapi/tests/snmpapi_test.exe$(DLLEXT)
|
||||
cp $(DLLDIR)/snmpapi/tests/snmpapi_test.exe$(DLLEXT) $@ && $(STRIP) $@
|
||||
spoolss_test.exe: $(DLLDIR)/spoolss/tests/spoolss_test.exe$(DLLEXT)
|
||||
cp $(DLLDIR)/spoolss/tests/spoolss_test.exe$(DLLEXT) $@ && $(STRIP) $@
|
||||
urlmon_test.exe: $(DLLDIR)/urlmon/tests/urlmon_test.exe$(DLLEXT)
|
||||
cp $(DLLDIR)/urlmon/tests/urlmon_test.exe$(DLLEXT) $@ && $(STRIP) $@
|
||||
user32_test.exe: $(DLLDIR)/user32/tests/user32_test.exe$(DLLEXT)
|
||||
|
|
|
@ -135,6 +135,7 @@ shdocvw_test.exe TESTRES "shdocvw_test.exe"
|
|||
shell32_test.exe TESTRES "shell32_test.exe"
|
||||
shlwapi_test.exe TESTRES "shlwapi_test.exe"
|
||||
snmpapi_test.exe TESTRES "snmpapi_test.exe"
|
||||
spoolss_test.exe TESTRES "spoolss_test.exe"
|
||||
urlmon_test.exe TESTRES "urlmon_test.exe"
|
||||
user32_test.exe TESTRES "user32_test.exe"
|
||||
usp10_test.exe TESTRES "usp10_test.exe"
|
||||
|
|
Loading…
Reference in New Issue