From: edoceo on
I have this and DllMain exposed properly in my code, but
InitializePrintMonitor2 never is called.

-- Code Snip --

BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
{
debug_log("DllMain()\n");
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
debug_log(" DLL_PROCESS_ATTACH\n");
hWHFPDInstance = hInst;
InitializeCriticalSection(&csSpoolerSection);
//InitializeCriticalSectionAndSpinCount(&csSpoolerSection, 0x80000000);
DisableThreadLibraryCalls(hInst);
return TRUE;
case DLL_PROCESS_DETACH:
debug_log(" DLL_PROCESS_DETACH\n");
return TRUE;
}
//debug_log(" UNKNOWN\n");
return TRUE;
}

LPMONITOR2 WINAPI InitializePrintMonitor2(PMONITORINIT pMonitorInit,
PHANDLE phMonitor)
{
// tried all kinds of stuff here, why won't this function be called?
debug_log("InitializePrintMonitor2()\n");
*phMonitor = (PHANDLE)pMonitorInit;
return(&M2);
}

-- End Code Snip --
I have a monitor.inf file in my installation directory and when installing I
can see that DllMain is called. Why wouldn't InitializePrintMonitor2 be
called?

-- Monitor.inf

[Version]
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer
DriverVer=06/27/2006,0.0.0.1
Provider="Edoceo, Inc."
Signature="$Windows NT$"

; Indicate I'm a Port Monitor"
[PortMonitors]
"whfpm" = whfpm_mon

[whfpm_mon]
CopyFiles = @whfpd.dll
PortMonitorDll = whfpd.dll
Needs=pscript.oem

[SourceDisksFiles]
whfpd.dll = 1,\debug,

[SourceDisksNames]
1 = "WHFPMD Installation Disk",,,

From: edoceo on
Nevermind. I figured this one out on my own. Again.



"edoceo" wrote:

> I have this and DllMain exposed properly in my code, but
> InitializePrintMonitor2 never is called.
>
> -- Code Snip --
>
> BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
> {
> debug_log("DllMain()\n");
> switch (dwReason)
> {
> case DLL_PROCESS_ATTACH:
> debug_log(" DLL_PROCESS_ATTACH\n");
> hWHFPDInstance = hInst;
> InitializeCriticalSection(&csSpoolerSection);
> //InitializeCriticalSectionAndSpinCount(&csSpoolerSection, 0x80000000);
> DisableThreadLibraryCalls(hInst);
> return TRUE;
> case DLL_PROCESS_DETACH:
> debug_log(" DLL_PROCESS_DETACH\n");
> return TRUE;
> }
> //debug_log(" UNKNOWN\n");
> return TRUE;
> }
>
> LPMONITOR2 WINAPI InitializePrintMonitor2(PMONITORINIT pMonitorInit,
> PHANDLE phMonitor)
> {
> // tried all kinds of stuff here, why won't this function be called?
> debug_log("InitializePrintMonitor2()\n");
> *phMonitor = (PHANDLE)pMonitorInit;
> return(&M2);
> }
>
> -- End Code Snip --
> I have a monitor.inf file in my installation directory and when installing I
> can see that DllMain is called. Why wouldn't InitializePrintMonitor2 be
> called?
>
> -- Monitor.inf
>
> [Version]
> ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
> Class=Printer
> DriverVer=06/27/2006,0.0.0.1
> Provider="Edoceo, Inc."
> Signature="$Windows NT$"
>
> ; Indicate I'm a Port Monitor"
> [PortMonitors]
> "whfpm" = whfpm_mon
>
> [whfpm_mon]
> CopyFiles = @whfpd.dll
> PortMonitorDll = whfpd.dll
> Needs=pscript.oem
>
> [SourceDisksFiles]
> whfpd.dll = 1,\debug,
>
> [SourceDisksNames]
> 1 = "WHFPMD Installation Disk",,,
>