When I move the driver from where it was compiled to /system32, it no longer works.
At a guess, I suspect that GetFullPathName is the problem.



start proc

LOCAL hSCManager:HANDLE
LOCAL hService:HANDLE
LOCAL acDriverPath:CHAR

; Open a handle to the SC Manager database
invoke OpenSCManager, NULL, NULL, SC_MANAGER_CREATE_SERVICE
.if eax != NULL
mov hSCManager, eax

push eax
invoke GetFullPathName, $CTA0("beeper.sys"), sizeof acDriverPath, addr acDriverPath, esp
    pop eax

; Register driver in SCM active database
invoke CreateService, hSCManager, $CTA0("beeper"), $CTA0("Nice Melody Beeper"), \
SERVICE_START + DELETE, SERVICE_KERNEL_DRIVER, SERVICE_AUTO_START, \
SERVICE_ERROR_NORMAL, addr acDriverPath, NULL, NULL, NULL, NULL, NULL
.if eax != NULL
mov hService, eax
invoke StartService, hService, 0, NULL

              ; Here driver beeper.sys plays its nice melody
; and reports error to be removed from memory
; Remove driver from SCM database
;invoke DeleteService, hService

Posted on 2010-09-18 16:40:02 by skywalker
The filepath of the driver was Registered to the SCM.
And you changed the filepath but not the registry entry.
You can unregister the driver and register it again to its new location.
Or just modify the registry entry.

Posted on 2010-09-19 01:06:17 by Homer