bool InstallDriver(char* pszDriverPath, char* pszDriverName) { SC_HANDLE
hSCManager; SC_HANDLE hService; //Remove any previous instance of the
driver RemoveDriver(pszDriverName); hSCManager=OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS); if (hSCManager) { //Install the driver
hService=CreateService( hSCManager, pszDriverName, pszDriverName,
SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL, pszDriverPath, NULL, NULL, NULL, NULL, NULL);
CloseServiceHandle(hSCManager); if (hService==NULL) return FALSE; } else
return FALSE; CloseServiceHandle(hService); return TRUE; }
bool RemoveDriver(char* pszDriverName) { SC_HANDLE hSCManager; SC_HANDLE
hService; BOOL bResult; SetLastError(0); StopDriver(pszDriverName); int
err=GetLastError(); hSCManager=OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS); if (hSCManager) {
hService=OpenService(hSCManager, pszDriverName, SERVICE_ALL_ACCESS);
CloseServiceHandle(hSCManager); if (hService) {
bResult=DeleteService(hService); CloseServiceHandle(hService); } else
return FALSE; } else return FALSE; return bResult; }
bool StartDriver(char* pszDriverName) { SC_HANDLE hSCManager; SC_HANDLE
hService; BOOL bResult; hSCManager=OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS); if (hSCManager) {
hService=OpenService(hSCManager, pszDriverName, SERVICE_ALL_ACCESS);
CloseServiceHandle(hSCManager); if (hService) {
bResult=StartService(hService, 0, NULL); if (bResult==FALSE) { int
err=GetLastError(); if (err==ERROR_SERVICE_ALREADY_RUNNING)
bResult=TRUE; } CloseServiceHandle(hService); } else return FALSE; }
else return FALSE; return bResult; }
InstallDriver("c:\\sys\\vdums.sys","VDUMS")) { StartDriver("VDUMS");
hf=CreateFile(VDUM_CTL_DOSDEV_NAME, GENERIC_READ | GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if
(hf==INVALID_HANDLE_VALUE) { printf("Driver invalid\n"); }
Actually, your question is not exactly correct, and the difference is very
important. Your driver is being INSTALLED, but it is not being LOADED.
In order for a driver to be LOADED on a 64-bit system, it has to be signed
with a genuine class 3 code signing certificate, issued from one of the
companys on Microsoft "cross-certificate list". You cannot use a
self-created certificate for this.
http://www.microsoft.com/whdc/winlogo/drvsign/crosscert.mspx
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
The signtool with "c:\sys\MSCV-VSClass3.cer" dont't work.
I want signed my driver vdums.
How i do ?????
Signtool sign /v /ac "c:\sys\MSCV-VSClass3.cer" /v /s Personnel /n
VDUMS /t http://timestamp.globalsign.com/scripts/timestamp.dll
"c:\sys\vdums.sys"
SignTool Error: File not found:
I also test :
Signtool sign /v /ac "c:\sys\MSCV-VSClass3.cer" /v /s my /n VDUMS /t
http://timestamp.globalsign.com/scripts/timestamp.dll "c:\sys\vdums.sys
SignTool Error: No certificates were found that met all the given criteria.
i return this error my os is plateform French
Tim Roberts a �crit :
I believe you got a reply to this on [ntdev], right? The problem is you
need to buy a class 3 certificate, and I don't believe you've done that
yet.
OK i understand