I’ve posted here few times, that i’m trying to use the DrvDocumentEvent
function. I’m trying to use it on w2k.
following tips obtained from here, i’ve made a UI dll which act as a
wrapper, exporting every function defined by Printer Interface dll.
But for every function except DrvDocumentEvent, i’ve just loaded the
library “UNIDRVUI.DLL” and called GetProcAddress giving corresponding
unidrvui function as an argument.
The Entry point function name of the dll was “DllInitialize” but during
building, the following error occured.
“libc.lib(crt0.obj) : error LNK2001:unresolved external symbol _main”
I already declared that the entry function name was “DllInitialize” in
the SOURCES file adding the following sentence.
“DLLENTRY=DllInitialize”
but the error kept occured. So i changed the Entry function name as
“DllMain” and edited the line as “DLLENTRY=_DllMainCRTStartup”
Then the build command successed, And I Obtained the dll file.
So i installed with print driver dll file using *.inf file.
I thought it would success. I tried to make a MessageBox before
printing job start, but it didn’t work. I guess my dll isn’t being
called from the system.
Any idea about this problem? Why is the Dll file isn’t being called?
is there any missing process?
following codes are the files in the directory.
***Ashwin helped with The core structure of the files, and the
parts of the source code was writtened by DC with no warranties, and
confers no rights. ****
this is the .def file
LIBRARY UIWRAPPER
EXPORTS
DrvDeviceCapabilities
DevQueryPrintEx
DrvUpgradePrinter
DrvDocumentPropertySheets
DrvDevicePropertySheets
DrvConvertDevMode
DrvPrinterEvent
DrvQueryJobAttributes
DrvQueryColorProfile
DrvDriverEvent
DrvDocumentEvent
DrvSplDeviceCaps @ 254 PRIVATE
and the source code of the DllMain function(dll entry function)
BOOL WINAPI
DllMain(
HINSTANCE hModule,
DWORD Reason,
LPVOID pReserved
)
{
UNREFERENCED_PARAMETER(pReserved);
switch(Reason){
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
// LogDebug(DBG_PROCESS_ATTACH, (LPWSTR)(“DllInitialize:
DLL_PROCESS_ATTACH”));
break;
case DLL_PROCESS_DETACH:
// LogDebug(DBG_PROCESS_DETACH,
// (LPWSTR)(“DllInitialize:
// LL_PROCESS_DETACH Destroy CACHED data”));
break;
}
return (TRUE);
}
The structure of other functions(DrvDeviceCapabilities,
DrvDeviceCapabilities, DrvUpgradePrinter, etc…)
LONG
DrvDevicePropertySheets(
PPROPSHEETUI_INFO pPSUIInfo,
LPARAM lParam
)
{
FARPROC UIDllFunc;
UIDllFunc = WrapUnidrvUI(“DrvDevicePropertySheets”);
// The function WrapUnidrvUI loads the library and
// calls the corresponding function using GetProcAddress
return ((*UIDllFunc)(pPSUIInfo, lParam));
}
And last the SOURCES file
TARGETNAME=UIWRAPPER
TARGETPATH=obj
TARGETTYPE=DYNLINK
PRECOMPILED_CXX=1
PRECOMPILED_INCLUDE=precomp.h
PRECOMPILED_PCH=precomp.pch
PRECOMPILED_OBJ=precomp.obj
C_DEFINES=$(C_DEFINES) -DUMODE -DSTRICT -D_UNICODE -DUNICODE
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\advapi32.lib \
$(SDK_LIB_PATH)\winspool.lib \
$(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\uuid.lib
DLLENTRY=_DllMainCRTStartup
INCLUDES=.;$(SDK_INC_PATH)\MFC42
MSC_WARNING_LEVEL=/W3
MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /WX
SOURCES= UIWrapper.c
and also, precomp.h(Including many header files-stdio.h, winddi.h,
stdlib.h
etc…), makefile(same as DDK example file), UIWrapper.h(header for my
UIWrapper.c file) are in the directory.
Anyone can help?
I really have to make this happen.
i’ll be looking forward for advice.
-with respect
Souneil Park.-