dll main not called

Hi All,
When a catalog file is generated by
compiling using visual studio 2012, the dll for advanced property page is copied to
system32 but the advanced property page could not be seen on the driver properties. The dll main is not
called. I have posted the inx below.Is the issue is due to inx?why the dll is not loaded with catalog file?
;
; Featuredrv.inf
;

[Version]
Signature=“$WINDOWS NT$”
Class=FeatureDrv
ClassGuid={F7F1F0C5-0B4A-424C-AA8A-281845B7F5DC}
Provider=%ManufacturerName%
CatalogFile=Featuredrv.cat
DriverVer= 1.0

[DestinationDirs]
DriverDir=12
DllDir=11

; ================= Class section =====================

[ClassInstall32]
Addreg=FeatureClassReg

[FeatureClassReg]
HKR,0,%ClassName%
HKR,Icon,-5

[SourceDisksNames]
1 = %DiskName%,“”

[SourceDisksFiles]
Featuredrv.sys = 1,
FeatureAdvPage.dll =1,

;*****************************************
; Install Section
;*****************************************

[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$

[Standard.NT$ARCH$]
%Featuredrv.DeviceDesc%=Featuredrv_Device, Root\SamFeaturedrv

[Featuredrv_Device.NT]
CopyFiles=DriverDir,DllDir
AddReg = FeatureDevAdvanceSection

[FeatureDevAdvanceSection]
HKR,EnumPropPages32,“FeatureAdvPage.dll,FeaturePropPageProvider”

[DriverDir]
Featuredrv.sys
[DllDir]
FeatureAdvPage.dll

[Featuredrv_Device.NT.HW]
AddReg=Featuredrv_Device.NT.AddReg

[Featuredrv_Device.NT.AddReg]
HKR,DeviceCharacteristics,0x10001,0x0100
HKR,Security,“D:P(A;;GA;;;BA)(A;;GA;;;SY)”
HKR,DebugLogLevel,0x10001,0x3
HKR,MaxDevicesSupported,0x10001,0x0001

;-------------- Service installation
[Featuredrv_Device.NT.Services]
AddService = Featuredrv,%SPSVCINST_ASSOCSERVICE%, Featuredrv_Service_Inst

; -------------- Featuredrv driver install sections
[Featuredrv_Service_Inst]
DisplayName = %Featuredrv.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\Featuredrv.sys
LoadOrderGroup = Extended Base

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName=“Feature learners”
ClassName=“Feature”
DiskName = “Featuredrv Installation Disk”
Featuredrv.DeviceDesc = “Featuredrv Device”
Featuredrv.SVCDESC = “Featuredrv Service”

Does loadlibrary from your own test code work?

d

Bent from my phone


From: xxxxx@yahoo.inmailto:xxxxx
Sent: ?11/?25/?2014 7:27 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: [ntdev] dll main not called

Hi All,
When a catalog file is generated by
compiling using visual studio 2012, the dll for advanced property page is copied to
system32 but the advanced property page could not be seen on the driver properties. The dll main is not
called. I have posted the inx below.Is the issue is due to inx?why the dll is not loaded with catalog file?
;
; Featuredrv.inf
;

[Version]
Signature=“$WINDOWS NT$”
Class=FeatureDrv
ClassGuid={F7F1F0C5-0B4A-424C-AA8A-281845B7F5DC}
Provider=%ManufacturerName%
CatalogFile=Featuredrv.cat
DriverVer= 1.0

[DestinationDirs]
DriverDir=12
DllDir=11

; ================= Class section =====================

[ClassInstall32]
Addreg=FeatureClassReg

[FeatureClassReg]
HKR,0,%ClassName%
HKR,Icon,-5

[SourceDisksNames]
1 = %DiskName%,“”

[SourceDisksFiles]
Featuredrv.sys = 1,
FeatureAdvPage.dll =1,

;
; Install Section
;


[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$

[Standard.NT$ARCH$]
%Featuredrv.DeviceDesc%=Featuredrv_Device, Root\SamFeaturedrv

[Featuredrv_Device.NT]
CopyFiles=DriverDir,DllDir
AddReg = FeatureDevAdvanceSection

[FeatureDevAdvanceSection]
HKR,EnumPropPages32,“FeatureAdvPage.dll,FeaturePropPageProvider”

[DriverDir]
Featuredrv.sys
[DllDir]
FeatureAdvPage.dll

[Featuredrv_Device.NT.HW]
AddReg=Featuredrv_Device.NT.AddReg

[Featuredrv_Device.NT.AddReg]
HKR,DeviceCharacteristics,0x10001,0x0100
HKR,Security,“D:P(A;;GA;;;BA)(A;;GA;;;SY)”
HKR,DebugLogLevel,0x10001,0x3
HKR,MaxDevicesSupported,0x10001,0x0001

;-------------- Service installation
[Featuredrv_Device.NT.Services]
AddService = Featuredrv,%SPSVCINST_ASSOCSERVICE%, Featuredrv_Service_Inst

; -------------- Featuredrv driver install sections
[Featuredrv_Service_Inst]
DisplayName = %Featuredrv.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\Featuredrv.sys
LoadOrderGroup = Extended Base

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName=“Feature learners”
ClassName=“Feature”
DiskName = “Featuredrv Installation Disk”
Featuredrv.DeviceDesc = “Featuredrv Device”
Featuredrv.SVCDESC = “Featuredrv Service”


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron,
Thanks for the reply. It works fine when compiled using wdk build environment where the catalog file is not generated. The advanced property page is produced and changes are reflected in registry. But fails when catalog file is generated either by vs 2012 or inf2cat manually.

You didn’t answer my question. When you sign it, can you load the dll into your own test process or not?

d

Bent from my phone


From: xxxxx@yahoo.inmailto:xxxxx
Sent: ?11/?25/?2014 7:40 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] dll main not called

Hi Doron,
Thanks for the reply. It works fine when compiled using wdk build environment where the catalog file is not generated. The advanced property page is produced and changes are reflected in registry. But fails when catalog file is generated either by vs 2012 or inf2cat manually.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron,
I don’t use a LoadLibrary function to load the dll. When the driver is installed the DLL main function in the DLL is not called. The below is the def file used to export the entry point function.

Feature.def
LIBRARY FeatureAdvPage.dll

EXPORTS
FeaturePropPageProvider

  1. re-read my response
  2. write a simple test app that calls LoadLibrary on your DLL
  3. see what happens

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.in
Sent: Tuesday, November 25, 2014 8:21 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] dll main not called

Hi Doron,
I don’t use a LoadLibrary function to load the dll. When the driver is installed the DLL main function in the DLL is not called. The below is the def file used to export the entry point function.

Feature.def
LIBRARY FeatureAdvPage.dll

EXPORTS
FeaturePropPageProvider


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Doron,
Thanks. When tried to call LoadLibrary from a test app, got a message as MSVCR110D.dll missing. I fixed it by copying the dll to system32 and everything started working. But, why did it work when compiled with wdk build environment and no catalog file generated? what is the role of MSVCR110D.dll and catalog file in this issue?

When you say wdk build environment, do you mean the win8.1 wdk or the win7 wdk?

d

Bent from my phone


From: xxxxx@yahoo.inmailto:xxxxx
Sent: ?11/?26/?2014 7:45 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] dll main not called

Hi Doron,
Thanks. When tried to call LoadLibrary from a test app, got a message as MSVCR110D.dll missing. I fixed it by copying the dll to system32 and everything started working. But, why did it work when compiled with wdk build environment and no catalog file generated? what is the role of MSVCR110D.dll and catalog file in this issue?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

MSVCR110D.dll is the debug crt that ships with VS. MSVCR110.dll is the retail version which also needs to be present. If you need MSVCR110D you are trying to install the debug build of your dll

d

Bent from my phone


From: xxxxx@yahoo.inmailto:xxxxx
Sent: ?11/?26/?2014 7:45 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] dll main not called

Hi Doron,
Thanks. When tried to call LoadLibrary from a test app, got a message as MSVCR110D.dll missing. I fixed it by copying the dll to system32 and everything started working. But, why did it work when compiled with wdk build environment and no catalog file generated? what is the role of MSVCR110D.dll and catalog file in this issue?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

Hi Doron,
wdk 7 build environment is used. Yes. I installed debug version. But why MSVCR110D or MSVCR110 is needed depending on the build version. Why does it not bundled with OS rather needs to be installed explicitly for particular application?

The win7 WDK let you link against the OS CRT (msvcrt.dll). this was quite fragile for both you and the OS itself, very hard to test and change the platform. Starting in win8, you link against the VS CRT instead. If you don’t want to deal with the VS CRT you can choose static linking

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.in
Sent: Wednesday, November 26, 2014 8:05 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] dll main not called

Hi Doron,
wdk 7 build environment is used. Yes. I installed debug version. But why MSVCR110D or MSVCR110 is needed depending on the build version. Why does it not bundled with OS rather needs to be installed explicitly for particular application?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks. But when built using wdk 7 and generated catalog file using inf2cat and signed using signtool manually, it didn’t work. If it will link with msvcrt.dll why did it not work?

No idea. You have to debug

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.in
Sent: Wednesday, November 26, 2014 9:26 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] dll main not called

Thanks. But when built using wdk 7 and generated catalog file using inf2cat and signed using signtool manually, it didn’t work. If it will link with msvcrt.dll why did it not work?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Just test the release build, not debug.

Actually, there is no need to ever make a debug build, unless you have some specific bugfixing scenario where the debug build can help.

Using the debug build for everyday testing is just a waste of time.

And yes, in your current scenario, the debug build wants the specific CRT DLL which is absent on your system (with the release version of the same DLL probably present), and will require installing some C runtime redist package.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi Doron,
> Thanks. When tried to call LoadLibrary from a test app, got a message as MSVCR110D.dll missing. I fixed it by copying the dll to system32 and everything started working. But, why did it work when compiled with wdk build environment and no catalog file generated? what is the role of MSVCR110D.dll and catalog file in this issue?
>

>MSVCR110 is needed depending on the build version. Why does it not bundled with OS rather

needs to be installed explicitly for particular application?

Older pre-MSVC WDK uses the bundled MSVCRT.DLL for all user mode code, even for checked (debug) builds, provided the DEBUG_CRTS macro is not set.

Nevertheless, MS invented some new DLL hell policy (MS’s battle with a DLL hell is a constant loss, they fix one scenario to introduce another, and make something easier while making another scenario harder), according to which dynlinking the bundled MSVCRT.DLL is deprecated for anything except the OS-provided binaries.

And no, the modern numbered MS C runtime DLLs are not installed for particular application, they are installed for all user-mode code built with this MSVC build version, which can be a plenty.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com