阅读:2272回复:16
编译错误
我得错误如下:
thisinit.c(29) : error C2143: syntax error : missing \';\' before \'type\' thisinit.c(49) : error C2065: \'status\' : undeclared identifier thisinit.c(53) : error C2061: syntax error : identifier \'DriverUnload\' thisinit.c(53) : error C2059: syntax error : \';\' thisinit.c(53) : error C2059: syntax error : \'type\' Compiling - dispatch.c for i386 dispatch.c(25) : error C2275: \'PKDEVICE_QUEUE_ENTRY\' : illegal use of this type as an expression dispatch.c(25) : error C2146: syntax error : missing \';\' before identifier \'Queu eEntry\' dispatch.c(25) : error C2065: \'QueueEntry\' : undeclared identifier Linking Executable - objchk\\i386\\objfre.sys for i386 link() : error LNK1181: cannot open input file \"objchk\\i386\\thisinit.obj\" BUILD: Linking d:\\eefile\\ntddk\\2005415 directory Compiling - thisinit.c for i386 thisinit.c(29) : error C2143: syntax error : missing \';\' before \'type\' 我的程序如下: /////////////////////thisinit.h //no error #ifdef __cplusplus extern \"C\" { #endif #include \"D:\\EEFILE\\NTDDK\\inc\\wdm.h\" #include \"D:\\EEFILE\\NTDDK\\inc\\ddk\\ntddk.h\" #ifdef __cplusplus } #endif typedef struct _DEVICE_EXTENTION{ //这个结构在内存中开辟一个区域存储专用的信息 PDEVICE_OBJECT pPhysicalDeviceObject; PDEVICE_OBJECT pLowerDeviceObject; PDEVICE_OBJECT pDeviceObject; IO_REMOVE_LOCK RemoveLock; UNICODE_STRING InterfaceName; //这个用于保存设备接口状态 DEVICE_POWER_STATE DevicePower; //电源状态 SYSTEM_POWER_STATE SystemPower; //电源状态 PULONG IdleCount; DEVICE_CAPABILITIES DevieCaps; LONG Handles; ULONG InterruptSource; // PKINTERRUPT pInterruptObject; //一个指向中断对象的指针 LIST_ENTRY InterruptEventList; KSPIN_LOCK InterruptEventListLock; PUCHAR PortBase; ULONG PortCount; BOOLEAN bMappedPort; // true if we mapped port addr in StartDevice BOOLEAN bBusy; // true if device busy with a request BOOLEAN bStalledForPower; // power management has stalled IRP queue //事件对象指针 PKEVENT pWaitEvent; BOOLEAN bSetWaitEvent; //PCI9052内部寄存器映射的内存资源 ULONG *MemBase; //用于读写内存 PHYSICAL_ADDRESS PhysicalMemBase; // 用于读写内存 ULONG MemCount; //用于读写内存 //自定义内存资源 ULONG *PdcMemBase; //用于读写内存 PHYSICAL_ADDRESS PdcPhysicalMemBase; //用于读写内存 ULONG PdcMemCount; //用于读写内存 signed long UsageCount; //The pending I/O Count BOOLEAN bStopping; // KEVENT StoppingEvent; // Set when all pending I/O complete BOOLEAN GotResource; // NTSTATUS TransmitIrpStatus; }DEVICE_EXTENSION,*PDEVICE_EXTENSION; //////initfunction /********************************************** * Init Functions **********************************************/ NTSTATUS DriverUnload(IN PDRIVER_OBJECT pDriverObject); /********************************************** * Pnp Functions **********************************************/ NTSTATUS DispatchPnp(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DefaultPnpHandler(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS PnpRemoveDevice(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS PnpStartDevice(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS PnpStopDevice(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS ForwardAndWait(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS AddDevice(IN PDRIVER_OBJECT pDriverObject, IN PDEVICE_OBJECT pdo); VOID RemoveDevice(IN PDEVICE_OBJECT fdo); NTSTATUS StartDevice(IN PDEVICE_OBJECT fdo, IN PCM_PARTIAL_RESOURCE_LIST ResourceListRaw, IN PCM_PARTIAL_RESOURCE_LIST ResourceList); VOID StopDevice(IN PDEVICE_OBJECT fdo); BOOLEAN LockDevice(IN DEVICE_EXTENSION *pdx); VOID UnlockDevice(IN DEVICE_EXTENSION *pdx); NTSTATUS OnRequestComplete(IN PDEVICE_OBJECT fdo, IN PIRP pIrp, IN PKEVENT pKEvent); unsigned char GetBarIndex(IN PHYSICAL_ADDRESS address, IN PCI_COMMON_CONFIG *pciRegs); NTSTATUS CompleteRequest(IN PIRP Irp, IN NTSTATUS status); NTSTATUS CompleteRequestInfo(IN PIRP Irp, IN NTSTATUS status, IN ULONG_PTR info); /********************************************** * Dispath Functions **********************************************/ NTSTATUS DispatchCreate(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchCleanup(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchClose(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchRead(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchWrite(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchSystemControl(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); NTSTATUS DispatchIoControl(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); VOID StartIo(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); VOID CancelIrp(IN PDEVICE_OBJECT fdo, IN PIRP pIrp); /********************************************** * Interupt Functions **********************************************/ BOOLEAN OnInterrupt(IN PKINTERRUPT pInterrupt, IN PDEVICE_EXTENSION pdx);//PVOID pdx); // VOID DpcForIsr(IN PKDPC pDpc, IN PDEVICE_OBJECT fdo, IN PIRP Irp, IN PDEVICE_EXTENSION pdx); BOOLEAN EnablePciInterrupt(IN PDEVICE_EXTENSION pdx); BOOLEAN DisablePciInterrupt(IN PDEVICE_EXTENSION pdx); /********************************************** * Power Functions **********************************************/ NTSTATUS DispatchPower(IN PDEVICE_OBJECT fdo, IN PIRP Irp); NTSTATUS DefaultPowerHandler(IN PDEVICE_OBJECT fdo, IN PIRP Irp); NTSTATUS PowerSetPower(IN PDEVICE_OBJECT fdo, IN PIRP Irp); NTSTATUS PowerQueryPower(IN PDEVICE_OBJECT fdo, IN PIRP Irp); NTSTATUS OnFinishPowerUp(IN PDEVICE_OBJECT fdo, IN PIRP Irp, IN PVOID junk); VOID OnPowerRequestComplete(IN PDEVICE_OBJECT DeviceObject, IN unsigned char MinorFunction, IN POWER_STATE PowerState, IN PVOID context, IN PIO_STATUS_BLOCK ioStatus); NTSTATUS SendDeviceSetPower(IN PDEVICE_OBJECT fdo, IN DEVICE_POWER_STATE state, IN ULONG context); VOID SetPowerState(IN PDEVICE_OBJECT fdo, IN DEVICE_POWER_STATE state); BOOLEAN EmpowerDevice(IN DEVICE_EXTENSION *pdx, IN DEVICE_POWER_STATE state); NTSTATUS SendSelfSetPowerRequest(IN PDEVICE_OBJECT fdo, IN DEVICE_POWER_STATE state); //////////////////dispatch.c #include <thisinit.h> #include <loctl.h> NTSTATUS DispatchCreate(IN PDEVICE_OBJECT fdo, IN PIRP pIrp) { //DispatchCreate //DebugPrint(\"PCIVGA: CreateFile.\"); //可以在此,做一些初始化工作 return CompleteRequestInfo(pIrp, STATUS_SUCCESS,0); } //DispatchCreate NTSTATUS DispatchCleanup(IN PDEVICE_OBJECT fdo, IN PIRP pIrp) { //DispatchCleanup PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension; KIRQL OldIrql; //DebugPrintMsg(\"DispatchCleanup Start.\"); IoAcquireCancelSpinLock(&OldIrql); // Cancel all IRPs in the I/O Manager maintained queue in device object PKDEVICE_QUEUE_ENTRY QueueEntry; //清除所有的IRP while((QueueEntry=KeRemoveDeviceQueue(&fdo->DeviceQueue)) != NULL) { PIRP CancelIrp = CONTAINING_RECORD(QueueEntry,IRP,Tail.Overlay.DeviceQueueEntry); CancelIrp->Cancel = TRUE; CancelIrp->CancelIrql = OldIrql; CancelIrp->CancelRoutine = NULL; IoReleaseCancelSpinLock(OldIrql); //DebugPrint(\"WdmIoDispatchCleanup: Cancelling %x %I\",CancelIrp,CancelIrp); UnlockDevice(pdx); CancelIrp->IoStatus.Status = STATUS_CANCELLED; CancelIrp->IoStatus.Information = 0; IoCompleteRequest(CancelIrp,IO_NO_INCREMENT); IoAcquireCancelSpinLock(&OldIrql); } IoReleaseCancelSpinLock(OldIrql); return CompleteRequestInfo(pIrp,STATUS_SUCCESS,0); } //DispatchCleanup NTSTATUS DispatchClose(IN PDEVICE_OBJECT fdo, IN PIRP pIrp) { //DispatchClose //DebugPrint(\"PCIVGA: CloseFile.\"); //进行处理 PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension; pdx->pWaitEvent = NULL; pdx->bSetWaitEvent = NULL; return CompleteRequestInfo(pIrp,STATUS_SUCCESS,0); } ///////////////pnp.c //这个文件用于管理即插即用 #include <thisinit.h> NTSTATUS AddDevice(IN PDRIVER_OBJECT pDriverObject, IN PDEVICE_OBJECT pdo) { NTSTATUS status; PDEVICE_OBJECT fdo; PDEVICE_EXTENSION pdx; //创建一个设备对象 status = IoCreateDevice(pDriverObject, sizeof(DEVICE_EXTENSION), NULL, FILE_DEVICE_UNKNOWN,0,FALSE,&fdo); if(!NT_SUCCESS(status)) { return status; } //初始化设备扩展 pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension; __try { pdx->pDeviceObject = fdo; pdx->pPhysicalDeviceObject = pdo ; pdx->UsageCount = 1; KeInitializeEvent(&pdx->StoppingEvent,NotificationEvent,FALSE);//初始化核心事件 pdx->bStopping = FALSE; pdx->GotResource =FALSE; fdo->Flags |= DO_BUFFERED_IO; //这个表示以何种方式处理用户 模式 的内存缓冲区 IoInitializeDpcRequest(fdo,DpcForIsr); //初始化一个dpc队列 status = IoRegisterDeviceInterface(fdo,\"123\",NULL, &pdx->InterfaceName); //注册一个设备接口编号 if(!NT_SUCCESS(status)) { __leave; } pdx->pLowerDeviceObject = IoAttachDeviceToDeviceStack(fdo,pdo); //将创建的设备实力加入设备栈空间 if(!pdx->pLowerDeviceObject) { status = STATUS_DEVICE_REMOVED; __leave; } IoSetDeviceInterfaceState(&pdx->InterfaceName,TRUE); //设定设备接口状态 pdx->SystemPower = PowerSystemWorking; //pdx->DevicePower = PowerDeviceD0; fdo->Flags |= DO_POWER_PAGABLE; //这个用于设定电源,将调用IRP_MJ_POWER上的派遣函数 //POWER_STATE state; //state.DeviceState = PowerDeviceD0; ///PoSetPowerState(fdo,DevicePowerState,state); pdx->bSetWaitEvent = FALSE; pdx->pWaitEvent = NULL; fdo->Flags &=~DO_DEVICE_INITIALIZING; //在初始化完成后加入这个标志驱动程序将不接受任何外部不相关请求 } __finally { if(!NT_SUCCESS(status)) //出现例外情况 { if(pdx->InterfaceName.Buffer) RtlFreeUnicodeString(&pdx->InterfaceName); if(pdx->pLowerDeviceObject) IoDetachDevice(pdx->pLowerDeviceObject); IoDeleteDevice(fdo); } } return STATUS_SUCCESS; } NTSTATUS DispatchPnp(IN PDEVICE_OBJECT fdo,IN PIRP pIrp){ NTSTATUS status; PIO_STACK_LOCATION stack; PDEVICE_EXTENSION pdx; pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension; if(!LockDevice(pdx)) { return CompleteRequestInfo(pIrp,STATUS_DELETE_PENDING,0); } stack = IoGetCurrentIrpStackLocation(pIrp); switch(stack->MinorFunction) { case IRP_MN_START_DEVICE: //必须 status=PnpStartDevice(fdo,pIrp); break; case IRP_MN_STOP_DEVICE: // status = PnpStopDevice(fdo,pIrp); break; case IRP_MN_REMOVE_DEVICE: status = PnpRemoveDevice(fdo,pIrp); return status; break; case IRP_MN_QUERY_REMOVE_DEVICE: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_CANCEL_REMOVE_DEVICE: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_CANCEL_STOP_DEVICE: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_DEVICE_RELATIONS: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_INTERFACE: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_CAPABILITIES: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_RESOURCES: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_DEVICE_TEXT: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_READ_CONFIG: // status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_WRITE_CONFIG: // status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_EJECT: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_SET_LOCK: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_ID: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_PNP_DEVICE_STATE: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_QUERY_BUS_INFORMATION: status = DefaultPnpHandler(fdo,pIrp); break; case IRP_MN_DEVICE_USAGE_NOTIFICATION: status = DefaultPnpHandler(fdo,pIrp); break; //case IRP_MN_DEVICE_SURPRISE_REMOVAL: v ...................... ...................... ////////////////thisinit.c #include <thisinit.h> UNICODE_STRING servkey; NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,IN PUNICODE_STRING pRegistryPath) { //判断操作系统的类型并作出相应的返回 if(IoIsWdmVersionAvailable(0x01, 0x10) == FALSE) { //Determine OS version if (IoIsWdmVersionAvailable(0x01, 0x00) == TRUE) { // //DebugPrint(\"PCI9052Demo: OS supports WDM 1.0 (Windows 98)\"); } else { //DebugPrint(\"PCI9052Demo: WARNING - OS does not support WDM 1.0\"); } } else { //DebugPrint(\"PCIVGA OS support WDM\"); } //设定一个驱动程序对象 // NTSTATUS status = STATUS_SUCCESS; pDriverObject->DriverExtension->AddDevice = AddDevice; pDriverObject->DriverUnload = DriverUnload; pDriverObject ->MajorFunction[IRP_MJ_CREATE] = DispatchCreate; //派遣例程建立 pDriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose; //派遣例程关闭 pDriverObject ->MajorFunction[IRP_MJ_READ] = DispatchRead; //硬件读派遣例程 pDriverObject ->MajorFunction[IRP_MJ_WRITE] = DispatchWrite; //硬件写派遣例程 pDriverObject ->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchSystemControl; //派遣例程控制 pDriverObject ->DriverStartIo = StartIo; //指定一个函数//startio用于处理irp pDriverObject ->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup; pDriverObject->MajorFunction[IRP_MJ_PNP]=DispatchPnp;//为这个驱动对象设定一个消息堆栈 //pDriverObject ->MajorFunction[IRP_MJ_POWER] = DispatchPower;//为能源管理设定一个堆栈 pDriverObject ->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = DispatchSystemControl; servkey.Buffer = (PWSTR)ExAllocatePool(PagedPool,pRegistryPath->Length + sizeof(WCHAR)); if(!servkey.Buffer) return STATUS_INSUFFICIENT_RESOURCES; servkey.MaximumLength = pRegistryPath->Length + sizeof(WCHAR); RtlCopyUnicodeString(&servkey, pRegistryPath); return status; } NTSTATUS DriverUnload(IN PDRIVER_OBJECT pDriverObject) { RtlFreeUnicodeString(&servkey); NTSTATUS status=STATUS_SUCCESS; return status; } |
|
沙发#
发布于:2005-05-03 10:58
thisinit.c(29) : error C2143: syntax error : missing \';\' before \'type\' 改错的地方就可以啦 !! |
|
板凳#
发布于:2005-05-03 14:54
回复KMK
我按照提示该调了很多错误但是比如 error c2275 PKDEVICE_QUEUE_ENTRY\':illegal use of this type as an expression 这个错误 上面的PKDEVICE_QUEUE_ENTRY 在wdm.h中已经有定义并且在thisinit.h中进行了#include但是为什么在这个程序中仍然说明是一个非法符号. |
|
地板#
发布于:2005-05-03 18:32
回复KMK 你把PKDEVICE_QUEUE_ENTRY QueueEntry;这句话向上动两行, 放在KIRQL OldIrql;的上一行或者下一行试试。。 |
|
|
地下室#
发布于:2005-05-04 09:19
楼上兄弟我得问题解决了,但是还有一个问题
thisinit.c(54) : error C2275: \'NTSTATUS\' : illegal use of this type as an expres sion thisinit.c(54) : error C2146: syntax error : missing \';\' before identifier \'stat us\' thisinit.c(54) : error C2065: \'status\' : undeclared identifier 能否帮我解决 |
|
5楼#
发布于:2005-05-04 09:56
楼上兄弟我得问题解决了,但是还有一个问题 你把thisinit.c中的NTSTATUS status = STATUS_SUCCESS;一句 移动到最上面试试。 即: NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,IN PUNICODE_STRING pRegistryPath) { NTSTATUS status = STATUS_SUCCESS; //判断操作系统的类型并作出相应的返回 if(IoIsWdmVersionAvailable(0x01, 0x10) == FALSE) { //Determine OS version if (IoIsWdmVersionAvailable(0x01, 0x00) == TRUE) 以下省略。。。。。 |
|
|
6楼#
发布于:2005-05-04 16:11
回楼上兄弟我将NTSTATUS status = STATUS_SECCUSS;干脆移出函数移到了外面当成了一个全局量,错误成了
thisinit.c(54) : error C2275: \'NTSTATUS\' : illegal use of this type as an expres sion thisinit.c(54) : error C2146: syntax error : missing \';\' before identifier \'stat us\' 我考虑是不是我少了什么头文件我在thisinit.h中先加载wdm.h后加载ntddk.h 我的source文件为 TARGETNAME = objfre TARGETTYPE = DRIVER DRIVERTYPE = WDM TARGETPATH = OBJ INCLUDES=$(BASEDIR) \\inc; SOURCES = pcivga.rc \\ thisinit.c \\ pnp.c \\ dispatch.c NTTARGETFILES = PostBuildSteps |
|
7楼#
发布于:2005-05-04 16:55
回楼上兄弟我将NTSTATUS status = STATUS_SECCUSS;干脆移出函数移到了外面当成了一个全局量,错误成了 跟你说了,,你就按照我说的那样子改,,试试了,,, 应该差不多了。。 这个跟sources文件没有关系的。。。。 你怎么还加了一个ntddk.h啊?。。 #include \"D:\\EEFILE\\NTDDK\\inc\\ddk\\ntddk.h\"不要就可以了吧,, 如果你写的是WDM的驱动。。 |
|
|
8楼#
发布于:2005-05-04 16:58
那句话不能移出函数的。。照我说的改,
|
|
|
9楼#
发布于:2005-05-04 21:22
回楼上我是这样写的
#include <thisinit.h> UNICODE_STRING servkey; NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,IN PUNICODE_STRING pRegistryPath) { NTSTATUS status; status = STATUS_SUCCESS; //判断操作系统的类型并作出相应的返回 //if(IoIsWdmVersionAvailable(0x01, 0x10) == FALSE) //{ //Determine OS version // if (IoIsWdmVersionAvailable(0x01, 0x00) == TRUE) // { // //DebugPrint(\"PCI9052Demo: OS supports WDM 1.0 (Windows 98)\"); // } // else // { //DebugPrint(\"PCI9052Demo: WARNING - OS does not support WDM 1.0\"); // } // } // else // { //DebugPrint(\"PCIVGA OS support WDM\"); // } //设定一个驱动程序对象 // servkey.Buffer = (PWSTR)ExAllocatePool(PagedPool,pRegistryPath->Length + sizeof(WCHAR)); if(!servkey.Buffer) return STATUS_INSUFFICIENT_RESOURCES; servkey.MaximumLength = pRegistryPath->Length + sizeof(WCHAR); RtlCopyUnicodeString(&servkey, pRegistryPath); pDriverObject->DriverExtension->AddDevice = AddDevice; pDriverObject->DriverUnload = DriverUnload; pDriverObject ->MajorFunction[IRP_MJ_CREATE] = DispatchCreate; //派遣例程建立 pDriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose; //派遣例程关闭 pDriverObject ->MajorFunction[IRP_MJ_READ] = DispatchRead; //硬件读派遣例程 pDriverObject ->MajorFunction[IRP_MJ_WRITE] = DispatchWrite; //硬件写派遣例程 pDriverObject ->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchSystemControl; //派遣例程控制 pDriverObject ->DriverStartIo = StartIo; //指定一个函数//startio用于处理irp pDriverObject ->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup; pDriverObject->MajorFunction[IRP_MJ_PNP]=DispatchPnp;//为这个驱动对象设定一个消息堆栈 //pDriverObject ->MajorFunction[IRP_MJ_POWER] = DispatchPower;//为能源管理设定一个堆栈 pDriverObject ->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = DispatchSystemControl; return status; } NTSTATUS DriverUnload(IN PDRIVER_OBJECT pDriverObject) { RtlFreeUnicodeString(&servkey); NTSTATUS status=STATUS_SUCCESS; return status; } 但是build的结构还是出现: BUILD: Compiling d:\\eefile\\ntddk\\2005415 directory Compiling - thisinit.c for i386 thisinit.c(58) : error C2275: \'NTSTATUS\' : illegal use of this type as an expres sion thisinit.c(58) : error C2146: syntax error : missing \';\' before identifier \'stat us\' thisinit.c(58) : error C2065: \'status\' : undeclared identifier Linking Executable - objchk\\i386\\objfre.sys for i386 |
|
10楼#
发布于:2005-05-04 22:11
NTSTATUS DriverUnload(IN PDRIVER_OBJECT pDriverObject)
{ RtlFreeUnicodeString(&servkey); NTSTATUS status=STATUS_SUCCESS; return status; } 改为: NTSTATUS DriverUnload(IN PDRIVER_OBJECT pDriverObject) { NTSTATUS status=STATUS_SUCCESS; RtlFreeUnicodeString(&servkey); return status; } 就是DriverUnload历程的前两行交换一下位置了,,试试,, 一样的道理啊,,前面那样改好的,,还是有这样的问题,,就照着改不就成了,,, |
|
|
11楼#
发布于:2005-05-04 22:14
:P
|
|
|
12楼#
发布于:2005-05-04 23:34
你在c里用了cpp的语法,可用aiwadgj的方法 !!
通常Unload都不反回(return),可用下面 VOID DriverUnload(IN PDRIVER_OBJECT pDriverObject) { RtlFreeUnicodeString(&servkey); } |
|
13楼#
发布于:2005-05-05 08:26
高手果然够高手,问题大多是这样出来的我成功了。谢谢
|
|
14楼#
发布于:2005-05-05 09:20
高手果然够高手,问题大多是这样出来的我成功了。谢谢 其实正如KMK老大所说的,,DriverUnload一般的没有返回值的,, 声明为VOID 类型就可以了,,,呵呵,,, 问题解决了,,也不意思一下啊,,, :D |
|
|
15楼#
发布于:2005-05-05 14:25
回aiwadgj 40分已经双手送上再次表示感谢
|
|
16楼#
发布于:2005-05-05 15:37
回aiwadgj 40分已经双手送上再次表示感谢 怎么给了40 ?。。。给多了哦,,,客气了。。。 大家互相学习了。。。 |
|
|