You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
1.8 KiB
88 lines
1.8 KiB
/*++
|
|
|
|
Copyright (c) 1996-1999 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
main.c
|
|
|
|
Abstract:
|
|
|
|
Implementation of OEMGetInfo and OEMDevMode.
|
|
Shared by all Unidrv OEM test dll's.
|
|
|
|
Environment:
|
|
|
|
Windows NT Unidrv driver
|
|
|
|
Revision History:
|
|
|
|
// NOTICE-2002/3/14-takashim
|
|
// 04/07/97 -zhanw-
|
|
// Created it.
|
|
|
|
--*/
|
|
|
|
#include "pdev.h"
|
|
|
|
#include <strsafe.h>
|
|
|
|
BOOL APIENTRY
|
|
OEMGetInfo(
|
|
DWORD dwInfo,
|
|
PVOID pBuffer,
|
|
DWORD cbSize,
|
|
PDWORD pcbNeeded)
|
|
{
|
|
LPCSTR OEM_INFO[] = { "Bad Index",
|
|
"OEMGI_GETSIGNATURE",
|
|
"OEMGI_GETINTERFACEVERSION",
|
|
"OEMGI_GETVERSION",
|
|
};
|
|
|
|
VERBOSE(("OEMGetInfo(%s) entry.\n", OEM_INFO[dwInfo]));
|
|
|
|
// Validate parameters.
|
|
if( ( (OEMGI_GETSIGNATURE != dwInfo) &&
|
|
(OEMGI_GETINTERFACEVERSION != dwInfo) &&
|
|
(OEMGI_GETVERSION != dwInfo) ) ||
|
|
(NULL == pcbNeeded)
|
|
)
|
|
{
|
|
WARNING(("OEMGetInfo() ERROR_INVALID_PARAMETER.\n"));
|
|
|
|
// Did not write any bytes.
|
|
if(NULL != pcbNeeded)
|
|
*pcbNeeded = 0;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
// Need/wrote DWORD bytes.
|
|
*pcbNeeded = sizeof(DWORD);
|
|
|
|
// Validate buffer size. Minimum size is four bytes.
|
|
if( (NULL == pBuffer) || (sizeof(DWORD) > cbSize) )
|
|
{
|
|
WARNING(("OEMGetInfo() ERROR_INSUFFICIENT_BUFFER.\n"));
|
|
return FALSE;
|
|
}
|
|
|
|
// Write information to buffer.
|
|
switch(dwInfo)
|
|
{
|
|
case OEMGI_GETSIGNATURE:
|
|
*(LPDWORD)pBuffer = OEM_SIGNATURE;
|
|
break;
|
|
|
|
case OEMGI_GETINTERFACEVERSION:
|
|
*(LPDWORD)pBuffer = PRINTER_OEMINTF_VERSION;
|
|
break;
|
|
|
|
case OEMGI_GETVERSION:
|
|
*(LPDWORD)pBuffer = OEM_VERSION;
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|