File system filter driver build issue.

Hi All,

Problem : I was building a code of swapBuffers driver via swapBuffers.c file with “nmake” utility in XP WinDDK checked

environment. It creates a “swapBuffers.sys”(18 KB) file in objchk_wxp_x86 folder. It acts perfectly i.e. it is loaded via

“fltmc load swapBuffers” command perfectly and unloaded via " fltmc unload swapBuffers". But the same code run in Visual

studio 6.0 environment with the following settings, makes a driver but the size of swapBuffer.sys vary(17 KB). when i try to

load or unload this driver, it not work and gives an error message "Load failed with error: 0x80070002 , The system cannot

find the file specified."

Driver build environment settings:

Create project in Visual studio 6.0(VC++ 6.0)

* File -> New… -> Projects
* Chose Win32 Dynamic-link Library
* Enter project name and directory path (as usually)
* OK -> An empty DLL project -> Finish -> OK

Change project settings

* Project -> Settings
* Chose “All Configurations” in “Settings for” combo.

*Projet Settings:

-> C/C++ tab.

* Chose “General” in “Category” combo

* Chose “Program Database” in “Debug info” combo for “Win32 Debug” configuration.

* Chose “Code Generation” in “Category” combo

* Chose “__stdcall” in “Calling convention” combo
* Chose “8 Bytes *” in “Struct member alignment” combo

* Chose “Preprocessor” in “Category” combo

* Enter paths to DDK INCLUDE directories into “Additional include directories” edit in following

string:

$(BASEDIR)\inc,$(BASEDIR)\inc\ddk,$(BASEDIR)\inc\api,$(BASEDIR)\inc\crt,$(BASEDIR)\inc\wdf\kmdf

* Enter the following predefined constants into “Preprocessor definitions” edit(comma separated) :
DBG,DEBUG,_DEBUG,WIN32,_CONSOLE,_MBCS,X86 ( Win32Debug) configuration.

* Remove “/GZ” from “Project Options” edit in “Win32 Debug” configuration.

-> Link tab.

* Chose “General” in “Category” combo :

* Enter driver binary’es name in “Output filename” : “./Debug/swapBuffers.sys”

* Uncheck “Link incrementally” box.

* Chose “Input” in “Category” combo

* Check “Ignore all default libraries” box .

* Enter following list of .lib files in “Object/library modules” box(space separated) :

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fltLib.lib fltMgr.lib wdm.lib
msvcrt.lib ntoskrnl.lib

* Chose “Output” in “Category” combo

* Enter “DriverEntry” value in “Entry point symbol” edit.

* Chose “Debug” in “Category” combo

* Uncheck “Separate types” checkbox.

* Change “/subsystem:xxxxx” to “/subsystem:native”(for all configuration such as Debug, release and

All) and add “/driver” to “Project Options” edit (separately for each configuration).

* OK.
* File -> Save Workspace.

Why the size of created driver different for the same source file, but different environment ?
Any information or idea will be appreciated.
Thank you

Using anything other than the standard BUILD environemt and compiler is
asking for trouble. If you want to use Visual Studio get DDKBUILD, hacking
the setting is VC is a great way to create subtle bugs that will cost a ton
to find.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntfsd…
> Hi All,
>
> Problem : I was building a code of swapBuffers driver via swapBuffers.c
> file with “nmake” utility in XP WinDDK checked
>
> environment. It creates a “swapBuffers.sys”(18 KB) file in objchk_wxp_x86
> folder. It acts perfectly i.e. it is loaded via
>
> “fltmc load swapBuffers” command perfectly and unloaded via " fltmc
> unload swapBuffers". But the same code run in Visual
>
> studio 6.0 environment with the following settings, makes a driver but
> the size of swapBuffer.sys vary(17 KB). when i try to
>
> load or unload this driver, it not work and gives an error message “Load
> failed with error: 0x80070002 , The system cannot
>
> find the file specified.”
>
> Driver build environment settings:
>
>
> Create project in Visual studio 6.0(VC++ 6.0)
>
> * File -> New… -> Projects
> * Chose Win32 Dynamic-link Library
> * Enter project name and directory path (as usually)
> * OK -> An empty DLL project -> Finish -> OK
>
> Change project settings
>
> * Project -> Settings
> * Chose “All Configurations” in “Settings for” combo.
>
> *Projet Settings:
>
> -> C/C++ tab.
>
> * Chose “General” in “Category” combo
>
> * Chose “Program Database” in “Debug info” combo for “Win32 Debug”
> configuration.
>
> * Chose “Code Generation” in “Category” combo
>
> * Chose “__stdcall” in “Calling convention” combo
> * Chose “8 Bytes *” in “Struct member alignment” combo
>
> * Chose “Preprocessor” in “Category” combo
>
> * Enter paths to DDK INCLUDE directories into “Additional include
> directories” edit in following
>
> string:
>
>
> $(BASEDIR)\inc,$(BASEDIR)\inc\ddk,$(BASEDIR)\inc\api,$(BASEDIR)\inc\crt,$(BASEDIR)\inc\wdf\kmdf
>
> * Enter the following predefined constants into “Preprocessor
> definitions” edit(comma separated) :
> DBG,DEBUG,_DEBUG,WIN32,_CONSOLE,_MBCS,X86 ( Win32Debug) configuration.
>
> * Remove “/GZ” from “Project Options” edit in “Win32 Debug”
> configuration.
>
> -> Link tab.
>
> * Chose “General” in “Category” combo :
>
> * Enter driver binary’es name in “Output filename” :
> “./Debug/swapBuffers.sys”
>
> * Uncheck “Link incrementally” box.
>
> * Chose “Input” in “Category” combo
>
> * Check “Ignore all default libraries” box .
>
>
> * Enter following list of .lib files in “Object/library modules”
> box(space separated) :
>
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
> shell32.lib
> ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fltLib.lib
> fltMgr.lib wdm.lib
> msvcrt.lib ntoskrnl.lib
>
> * Chose “Output” in “Category” combo
>
> * Enter “DriverEntry” value in “Entry point symbol” edit.
>
> * Chose “Debug” in “Category” combo
>
> * Uncheck “Separate types” checkbox.
>
> * Change “/subsystem:xxxxx” to “/subsystem:native”(for all configuration
> such as Debug, release and
>
> All) and add “/driver” to “Project Options” edit (separately for each
> configuration).
>
> * OK.
> * File -> Save Workspace.
>
>
> Why the size of created driver different for the same source file, but
> different environment ?
> Any information or idea will be appreciated.
> Thank you
>
>

Hi,

take a look at http://www.osronline.com/article.cfm?id=104
and it would be probably a good idea to download and use DDKBUILD
when integrating into Visual Studio

have a nice day,

Sandor LUKACS
Virus Analyst, SOFTWIN

xxxxx@gmail.com wrote:

Hi All,

Problem : I was building a code of swapBuffers driver via swapBuffers.c file with “nmake” utility in XP WinDDK checked

environment. It creates a “swapBuffers.sys”(18 KB) file in objchk_wxp_x86 folder. It acts perfectly i.e. it is loaded via

“fltmc load swapBuffers” command perfectly and unloaded via " fltmc unload swapBuffers". But the same code run in Visual

studio 6.0 environment with the following settings, makes a driver but the size of swapBuffer.sys vary(17 KB). when i try to

load or unload this driver, it not work and gives an error message "Load failed with error: 0x80070002 , The system cannot

find the file specified."

Driver build environment settings:

Create project in Visual studio 6.0(VC++ 6.0)

* File -> New… -> Projects
* Chose Win32 Dynamic-link Library
* Enter project name and directory path (as usually)
* OK -> An empty DLL project -> Finish -> OK

Change project settings

* Project -> Settings
* Chose “All Configurations” in “Settings for” combo.

*Projet Settings:

-> C/C++ tab.

* Chose “General” in “Category” combo

* Chose “Program Database” in “Debug info” combo for “Win32 Debug” configuration.

* Chose “Code Generation” in “Category” combo

* Chose “__stdcall” in “Calling convention” combo
* Chose “8 Bytes *” in “Struct member alignment” combo

* Chose “Preprocessor” in “Category” combo

* Enter paths to DDK INCLUDE directories into “Additional include directories” edit in following

string:

$(BASEDIR)\inc,$(BASEDIR)\inc\ddk,$(BASEDIR)\inc\api,$(BASEDIR)\inc\crt,$(BASEDIR)\inc\wdf\kmdf

* Enter the following predefined constants into “Preprocessor definitions” edit(comma separated) :
DBG,DEBUG,_DEBUG,WIN32,_CONSOLE,_MBCS,X86 ( Win32Debug) configuration.

* Remove “/GZ” from “Project Options” edit in “Win32 Debug” configuration.

-> Link tab.

* Chose “General” in “Category” combo :

* Enter driver binary’es name in “Output filename” : “./Debug/swapBuffers.sys”

* Uncheck “Link incrementally” box.

* Chose “Input” in “Category” combo

* Check “Ignore all default libraries” box .

* Enter following list of .lib files in “Object/library modules” box(space separated) :

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fltLib.lib fltMgr.lib wdm.lib
msvcrt.lib ntoskrnl.lib

* Chose “Output” in “Category” combo

* Enter “DriverEntry” value in “Entry point symbol” edit.

* Chose “Debug” in “Category” combo

* Uncheck “Separate types” checkbox.

* Change “/subsystem:xxxxx” to “/subsystem:native”(for all configuration such as Debug, release and

All) and add “/driver” to “Project Options” edit (separately for each configuration).

* OK.
* File -> Save Workspace.

Why the size of created driver different for the same source file, but different environment ?
Any information or idea will be appreciated.
Thank you


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@bitdefender.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Building drivers this way is just plain not supported. Use the DDK or
DDKBUILD.BAT


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntfsd…
> Hi All,
>
> Problem : I was building a code of swapBuffers driver via swapBuffers.c file
with “nmake” utility in XP WinDDK checked
>
> environment. It creates a “swapBuffers.sys”(18 KB) file in objchk_wxp_x86
folder. It acts perfectly i.e. it is loaded via
>
> “fltmc load swapBuffers” command perfectly and unloaded via " fltmc unload
swapBuffers". But the same code run in Visual
>
> studio 6.0 environment with the following settings, makes a driver but the
size of swapBuffer.sys vary(17 KB). when i try to
>
> load or unload this driver, it not work and gives an error message “Load
failed with error: 0x80070002 , The system cannot
>
> find the file specified.”
>
> Driver build environment settings:
>
>
> Create project in Visual studio 6.0(VC++ 6.0)
>
> * File -> New… -> Projects
> * Chose Win32 Dynamic-link Library
> * Enter project name and directory path (as usually)
> * OK -> An empty DLL project -> Finish -> OK
>
> Change project settings
>
> * Project -> Settings
> * Chose “All Configurations” in “Settings for” combo.
>
> *Projet Settings:
>
> -> C/C++ tab.
>
> * Chose “General” in “Category” combo
>
> * Chose “Program Database” in “Debug info” combo for “Win32 Debug”
configuration.
>
> * Chose “Code Generation” in “Category” combo
>
> * Chose “__stdcall” in “Calling convention” combo
> * Chose “8 Bytes *” in “Struct member alignment” combo
>
> * Chose “Preprocessor” in “Category” combo
>
> * Enter paths to DDK INCLUDE directories into “Additional include
directories” edit in following
>
> string:
>
>
$(BASEDIR)\inc,$(BASEDIR)\inc\ddk,$(BASEDIR)\inc\api,$(BASEDIR)\inc\crt,$(BASED
IR)\inc\wdf\kmdf
>
> * Enter the following predefined constants into “Preprocessor definitions”
edit(comma separated) :
> DBG,DEBUG,_DEBUG,WIN32,_CONSOLE,_MBCS,X86 ( Win32Debug) configuration.
>
> * Remove “/GZ” from “Project Options” edit in “Win32 Debug” configuration.
>
> -> Link tab.
>
> * Chose “General” in “Category” combo :
>
> * Enter driver binary’es name in “Output filename” :
“./Debug/swapBuffers.sys”
>
> * Uncheck “Link incrementally” box.
>
> * Chose “Input” in “Category” combo
>
> * Check “Ignore all default libraries” box .
>
>
> * Enter following list of .lib files in “Object/library modules” box(space
separated) :
>
> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib
> ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fltLib.lib fltMgr.lib
wdm.lib
> msvcrt.lib ntoskrnl.lib
>
> * Chose “Output” in “Category” combo
>
> * Enter “DriverEntry” value in “Entry point symbol” edit.
>
> * Chose “Debug” in “Category” combo
>
> * Uncheck “Separate types” checkbox.
>
> * Change “/subsystem:xxxxx” to “/subsystem:native”(for all configuration such
as Debug, release and
>
> All) and add “/driver” to “Project Options” edit (separately for each
configuration).
>
> * OK.
> * File -> Save Workspace.
>
>
> Why the size of created driver different for the same source file, but
different environment ?
> Any information or idea will be appreciated.
> Thank you
>
>