ReactOS 0.4.15-dev-8127-g6338913
main.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Standard Print Processor API Tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Main functions
5 * COPYRIGHT: Copyright 2016 Colin Finck (colin@reactos.org)
6 */
7
8#include <apitest.h>
9
10#define WIN32_NO_STATUS
11#include <windef.h>
12#include <winbase.h>
13#include <wingdi.h>
14#include <winspool.h>
15
18{
19 DWORD cbNeeded;
20 HMODULE hWinprint;
21 PVOID pFunc;
22 WCHAR wszWinprintPath[MAX_PATH];
23
24 // Build the path to the default Print Processor winprint.dll in the Print Processor directory.
25 if (!GetPrintProcessorDirectoryW(NULL, NULL, 1, (LPBYTE)wszWinprintPath, sizeof(wszWinprintPath), &cbNeeded))
26 {
27 skip("Could not determine the path to the Print Processor directory, last error is %lu!\n", GetLastError());
28 return NULL;
29 }
30
31 wcscat(wszWinprintPath, L"\\winprint.dll");
32
33 // Try loading it.
34 hWinprint = LoadLibraryW(wszWinprintPath);
35 if (!hWinprint)
36 {
38 {
39 skip("LoadLibraryW failed for %S with error %lu!\n", wszWinprintPath, GetLastError());
40 return NULL;
41 }
42
43 // winprint.dll does not exist prior to NT6.
44 // The default Print Processor is implemented in localspl.dll instead.
45 hWinprint = LoadLibraryW(L"localspl.dll");
46 if (!hWinprint)
47 {
48 skip("LoadLibraryW failed for localspl.dll with error %lu!\n", GetLastError());
49 return NULL;
50 }
51 }
52
53 // Get the function we are looking for.
54 pFunc = GetProcAddress(hWinprint, FunctionName);
55 if (!pFunc)
56 {
57 skip("GetProcAddress failed for %s with error %lu!\n", FunctionName, GetLastError());
58 return NULL;
59 }
60
61 return pFunc;
62}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
Definition: acpixf.h:1279
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define LoadLibraryW(x)
Definition: compat.h:747
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID GetWinprintFunc(const char *FunctionName)
Definition: main.c:17
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
WINBOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
__wchar_t WCHAR
Definition: xmlstorage.h:180