Showing posts with label Driver. Show all posts
Showing posts with label Driver. Show all posts

Sep 7, 2009

How to get WHQL certificate for your driver

If you need to get WHQL from Microsoft for your driver, you need to pass Windows Logo Test. First you need a PC with Windows Server 2003 installed.
Then follow the steps in DTMHowTo.

When you pass the logo test ( sometimes you need to the support from Microsoft ), see Winqual Faq to know how to submit your result to Microsoft.

Mar 24, 2009

Microsoft Usbser.sys hot fix

Here is the list of Microsoft Hotfix of the notorious usbser.sys.

5.1.2600.3226: When you use a USB-to-Serial converter to connect a device to a Windows XP-based computer, the data transfer from the computer to the device is slower than expected. (KB943198)

5.1.2600.2930: The Usbser.sys driver may not load when a USB device uses an IAD to define a function that has multiple interfaces, and this function uses the Usbser.sys driver file in Windows XP. (KB918365)

5.1.2600.1330: A memory leak may occur when you repeatedly start and stop the Usbser.sys driver on a Windows XP-based computer. (KB831480)

Mar 11, 2009

Useful USB status code

Some useful USB status code which you may see when dealing with USB monitor

1.target stalled
USBD_STATUS_STALL_PID 0xC0000004

2.operation is cancelled by application
USBD_STATUS_CANCELED 0xC0010000

Jun 2, 2008

Force load mismatched pdb

Each pdb has checksum and timestamp which match the corresponding executable(exe or sys), and the timestamp and checksum changes everytime!!

Make it sure that you ship your executable to QA with the PDB file.

If you are not, try force load the symbol(if you are sure that the source is the same)
.reload /f /i xxx.sys

May 5, 2008

IRQL levels

#define PASSIVE_LEVEL 0x0
#define APC_LEVEL 0x1
#define DISPATCH_LEVEL 0x2
#define IPI_LEVEL 0xe
#define POWER_LEVEL 0xf
#define PROFILE_LEVEL 0xf
#define HIGH_LEVEL 0xf
#ifdef NT_UP
#define SYNCH_LEVEL 0x2
#else
#define SYNCH_LEVEL 0xc
#endif

Apr 20, 2008

Useful Status Code

STATUS_UNSUCCESSFUL
STATUS_DISK_FULL
STATUS_BUFFER_OVERFLOW
STATUS_PENDING
STATUS_TIMEOUT
STATUS_ABANDONED
STATUS_WAIT_0
STATUS_SUCCESS

Mar 27, 2008

DbgPrint Unicode string

DbgPrint("deviceObjName: %wZ\n", deviceObjName);

Mar 20, 2008

Replace windows driver

Here is a simple way.

1.Just copy new driver to Windows\System32\Drivers, and replace the old one.
2.Remove the device
3.Close all applications which are still using the device(Important!!!!)
4.Plug the device again

Mar 16, 2008

DbgPrint in Vista

See this
http://tenderlover.blogspot.com/search?q=dbgprint

or just import .reg file below


Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter]
"DEFAULT"=dword:00000008

Mar 11, 2008

Disable .NTAMD64 requirement of inf file

1.Establish the key
HKLM\Software\Microsoft\Windows\CurrentVersion\Setup
DisableDecoratedModelsRequirement:REG_DWORD

set it to 1

Mar 10, 2008

How to self sign 64 bit driver on Vista 64 for driver testing

1.install Microsoft Winqual Submission Tool
2.Find Inf2Cat.exe in Microsoft Winqual Submission Tool
3.execute
Inf2Cat.exe /driver:"U:\MyDriver" /os:Vista_X64

4.Find makecert.exe in WDK
Makecert -r -pe -ss PrivateCertStore -n "CN=TestCertforWDK" TestCert.cer

5.Use Signtool.exe in WDK to sign the cat file
Signtool sign /v /s PrivateCertStore /n TestCertForWDK /t http://timestamp.verisign.com/scripts/timestamp.dll "U:\MyDriver\MyDriver.cat"

6.Use Signtool.exe in WDK to sign the driver
Signtool sign /v /s PrivateCertStore /n TestCertForWDK /t http://timestamp.verisign.com/scripts/timestamp.dll "U:\MyDriver\MyDriver.sys"

7.Verify the sign for driver
Signtool verify /pa /v MyDriver.sys

8.Verify the sign for cat file
Signtool verify /pa /v /c MyDriver.cat MyDriver.inf

9.On test computer, import the certificate:
certmgr.exe /add TestCert.cer /s /r localMachine root
certmgr.exe /add TestCert.cer /s /r localMachine trustedpublisher

reference: Kernel-Mode Code Signing Walkthrough

Jan 23, 2008

WinDbg Settings

This is my WinDbg notes. WinDbg is a debugger which is used for Windows kernel mode program debugging.

Remote Debugging Settings On Guest OS:

1.Boot XP in debug mode:
Add this to c:\boot.ini

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional-DEBUG" /fastdetect /debug /debugport=COM1 /baudrate=115200

It would make your XP boot in Debug mode.
I am not sure if "/debug" is necessary or not.

2.Always boot in "Last Known Good Configuration":
Add this:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional-Good" /lastknowngood


WinDbg Startup Settings: windbg -k com:port=com1,baud=115200

Symbol path settings: SRV*c:\Symbols*http://msdl.microsoft.com/download/symbols

Useful Commands:
Set a breakpoint on the entry of FunctionName
bp DriverName ! FunctionName
list all breakpoints
bl
disable the #3 breakpoint
bd 3

3.Boot Vista in debug mode:
In Vista, Microsoft introduce a very hard-to-use boot loader setting tool called "bcdedit". You can use "easybcd" instead, but here I will show how to do it without third party tool.

3.1 Change serial port setting:
bcdedit /dbgsettings serial baudrate:115200 debugport:1

3.2 Create new debug entry:
bcdedit /copy {current} /d DebugEntry

3.3 List all entry:
bcdedit /enum osloader

3.4 Set debug option on:bcdedit /debug {ID} on

ID is the DebugEntry ID found at step 3.

3.5 Set DebugEntry as default choice:bcdedit /default {ID}

3.6 Turn LastKnownGood option onbcdedit /set {ID} lastknowngood on

3.7 Set Timeout value to 5 secondsbcdedit /timeout 5

3.8 No signing checks ( driver without sign can be installed)bcdedit –set nointegritychecks ON

3.9 Set driver test mode ( accept test sign)bcdedit /set testsigning Yes

 
TEMPLATE HACKS AND TWEAKS BY [ METAMUSE ] BLACKCAT 1.1
/scripts/shBrushJScript.js'/>