J'ai fait un pilote pour Windows, compilé et essayé de le lancer via le gestionnaire SC, mais je reçois l'erreur du système de l'API du gestionnaire de SC:Comment déboguer l'erreur de chargement du pilote?
ERROR_PROC_NOT_FOUND The specified procedure could not be found.
Y at-il un moyen d'obtenir plus d'informations sur pourquoi exactement le pilote ne parvient pas à démarrer? WinDbg ou quelque chose? Si je commente tout le code dans ma routine DriverEntry, le pilote démarre.
La seule chose que je vous appelle est une procédure dans un autre module source (dans mon propre projet, cependant). Je peux commenter toutes les dépendances externes et j'ai toujours la même erreur.
Edit:
J'ai aussi essayé différentes DDK, soit 2003 DDK und Vista WDK (mais pas Win7 WDK)
Edit2: Voici mon fichier code sour pilote driver.cpp:
#ifdef __cplusplus
extern "C" {
#endif
#include <ntddk.h>
#include <ntstrsafe.h>
#ifdef __cplusplus
}; // extern "C"
#endif
#include "../distorm/src/distorm.h"
void DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
}
#define MAX_INSTRUCTIONS 20
#ifdef __cplusplus
extern "C" {
#endif
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
UNICODE_STRING pFcnName;
// Holds the result of the decoding.
_DecodeResult res;
// Decoded instruction information.
_DecodedInst decodedInstructions[MAX_INSTRUCTIONS];
// next is used for instruction's offset synchronization.
// decodedInstructionsCount holds the count of filled instructions' array by the decoder.
unsigned int decodedInstructionsCount = 0, i, next;
// Default decoding mode is 32 bits, could be set by command line.
_DecodeType dt = Decode32Bits;
// Default offset for buffer is 0, could be set in command line.
_OffsetType offset = 0;
char* errch = NULL;
// Buffer to disassemble.
char *buf;
int len = 100;
// Register unload routine
DriverObject->DriverUnload = DriverUnload;
DbgPrint("diStorm Loaded!\n");
// Get address of KeBugCheck
RtlInitUnicodeString(&pFcnName, L"KeBugCheck");
buf = (char *)MmGetSystemRoutineAddress(&pFcnName);
offset = (unsigned) (_OffsetType)buf;
DbgPrint("Resolving KeBugCheck @ 0x%08x\n", buf);
// Decode the buffer at given offset (virtual address).
while (1) {
res = distorm_decode(offset, (const unsigned char*)buf, len, dt, decodedInstructions, MAX_INSTRUCTIONS, &decodedInstructionsCount);
if (res == DECRES_INPUTERR) {
DbgPrint(("NULL Buffer?!\n"));
break;
}
for (i = 0; i < decodedInstructionsCount; i++) {
// Note that we print the offset as a 64 bits variable!!!
// It might be that you'll have to change it to %08X...
DbgPrint("%08I64x (%02d) %s %s %s\n", decodedInstructions[i].offset, decodedInstructions[i].size,
(char*)decodedInstructions[i].instructionHex.p,
(char*)decodedInstructions[i].mnemonic.p,
(char*)decodedInstructions[i].operands.p);
}
if (res == DECRES_SUCCESS || decodedInstructionsCount == 0) {
break; // All instructions were decoded.
}
// Synchronize:
next = (unsigned int)(decodedInstructions[decodedInstructionsCount-1].offset - offset);
next += decodedInstructions[decodedInstructionsCount-1].size;
// Advance ptr and recalc offset.
buf += next;
len -= next;
offset += next;
}
DbgPrint(("Done!\n"));
return STATUS_SUCCESS;
}
#ifdef __cplusplus
}; // extern "C"
#endif
Ma structure de répertoire est comme ceci:
base_dir\driver\driver.cpp
\distorm\src\all_the_c_files
\distorm\distorm.h
\distorm\config.h
Mes sources fichier:
# $Id$
TARGETNAME=driver
TARGETPATH=obj
TARGETTYPE=DRIVER
# Additional defines for the C/C++ preprocessor
C_DEFINES=$(C_DEFINES) -DSUPPORT_64BIT_OFFSET
SOURCES=driver.cpp \
distorm_dummy.c \
drvversion.rc
INCLUDES=..\distorm\src;
TARGETLIBS=$(DDK_LIB_PATH)\ntdll.lib \
$(DDK_LIB_PATH)\ntstrsafe.lib
Vous pouvez télécharger diStorm d'ici: http://ragestorm.net/distorm/dl.php?id=8
distorm_dummy est le même que le dummy.c du diStorm lib.
Pourriez-vous s'il vous plaît publier le fichier source et peut-être le fichier .cpp de votre pilote? – Christopher
Je ne peux pas vraiment tester/construire le pilote actuellement, donc ... Pourriez-vous essayer de supprimer la partie externe "C" autour de DriverEntry, car elle est superflue. – Christopher
si je les supprime, je reçois des erreurs de construction: erreur LNK2019: symbole externe non résolu _DriverEntry @ 8 référencé dans la fonction _GsDriverEntry @ 8 \t 1> ..... driver \ bufferoverflowk.lib – SDD