2016-11-17 21:24:07 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Standard Print Processor API Tests
|
2017-09-29 18:33:04 +00:00
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
2016-11-17 21:24:07 +00:00
|
|
|
* PURPOSE: Main functions
|
2017-09-29 18:33:04 +00:00
|
|
|
* COPYRIGHT: Copyright 2016 Colin Finck (colin@reactos.org)
|
2016-11-17 21:24:07 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <apitest.h>
|
|
|
|
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <wingdi.h>
|
|
|
|
#include <winspool.h>
|
|
|
|
|
|
|
|
PVOID
|
|
|
|
GetWinprintFunc(const char* FunctionName)
|
|
|
|
{
|
|
|
|
DWORD cbNeeded;
|
|
|
|
HMODULE hWinprint;
|
|
|
|
PVOID pFunc;
|
|
|
|
WCHAR wszWinprintPath[MAX_PATH];
|
|
|
|
|
|
|
|
// Build the path to the default Print Processor winprint.dll in the Print Processor directory.
|
|
|
|
if (!GetPrintProcessorDirectoryW(NULL, NULL, 1, (LPBYTE)wszWinprintPath, sizeof(wszWinprintPath), &cbNeeded))
|
|
|
|
{
|
|
|
|
skip("Could not determine the path to the Print Processor directory, last error is %lu!\n", GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
wcscat(wszWinprintPath, L"\\winprint.dll");
|
|
|
|
|
|
|
|
// Try loading it.
|
|
|
|
hWinprint = LoadLibraryW(wszWinprintPath);
|
|
|
|
if (!hWinprint)
|
|
|
|
{
|
|
|
|
if (GetLastError() != ERROR_MOD_NOT_FOUND)
|
|
|
|
{
|
|
|
|
skip("LoadLibraryW failed for %S with error %lu!\n", wszWinprintPath, GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// winprint.dll does not exist prior to NT6.
|
|
|
|
// The default Print Processor is implemented in localspl.dll instead.
|
|
|
|
hWinprint = LoadLibraryW(L"localspl.dll");
|
|
|
|
if (!hWinprint)
|
|
|
|
{
|
|
|
|
skip("LoadLibraryW failed for localspl.dll with error %lu!\n", GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the function we are looking for.
|
|
|
|
pFunc = GetProcAddress(hWinprint, FunctionName);
|
|
|
|
if (!pFunc)
|
|
|
|
{
|
|
|
|
skip("GetProcAddress failed for %s with error %lu!\n", FunctionName, GetLastError());
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pFunc;
|
|
|
|
}
|