aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
阅读:2215回复:11

!!!为什么出现这样的错误???――WDM程序编译

楼主#
更多 发布于:2002-07-11 18:24
为什么出现这样的错误:
--------------------Configuration: aiherong - Win32 Debug--------------------
New or updated MSVC detected.  Updating DDK environment....
Setting environment for using Microsoft Visual C++ tools.
Starting dirs creation...Completed.
BUILD: Object root set to: ==> objchk
BUILD: /i switch ignored
BUILD: Compile and Link for i386
BUILD: Loading c:\\NTDDK\\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Examining c:\\temp\\lasthope\\aiherong directory for files to compile.
    c:\\temp\\lasthope\\aiherong
    c:\\temp\\lasthope\\aiherong - 1 source files (0 lines)
BUILD: Compiling c:\\temp\\lasthope\\aiherong directory
Compiling - aiherong.cpp for i386
Linking Executable - objchk\\i386\\aiherong.sys for i386
link() : error LNK2001: unresolved external symbol _DriverEntry@8
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall ObfDereferenceObject(void *)\" (__imp_?ObfDereferenceObject@@YIXPAX@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall IoDeleteDevice(struct _DEVICE_OBJECT *)\" (__imp_?IoDeleteDevice@@YGXPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoDeleteSymbolicLink(struct _UNICODE_STRING *)\" (__imp_?IoDeleteSymbolicLink@@YGJPAU_UNICODE_STRING@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoGetDeviceObjectPointer(struct _UNICODE_STRING *,unsigned long,struct _FILE_OBJECT * *,struct _DEVICE_OBJECT * *)\" (__imp_?IoGetDeviceObjectPointer@@YG
JPAU_UNICODE_STRING@@KPAPAU_FILE_OBJECT@@PAPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"unsigned long __cdecl DbgPrint(char *,...)\" (?DbgPrint@@YAKPADZZ)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateSymbolicLink(struct _UNICODE_STRING *,struct _UNICODE_STRING *)\" (__imp_?IoCreateSymbolicLink@@YGJPAU_UNICODE_STRING@@0@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateDevice(struct _DRIVER_OBJECT *,unsigned long,struct _UNICODE_STRING *,unsigned long,unsigned long,unsigned char,struct _DEVICE_OBJECT * *)\" (__i
mp_?IoCreateDevice@@YGJPAU_DRIVER_OBJECT@@KPAU_UNICODE_STRING@@KKEPAPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall RtlInitUnicodeString(struct _UNICODE_STRING *,unsigned short const *)\" (__imp_?RtlInitUnicodeString@@YGXPAU_UNICODE_STRING@@PBG@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall IofCompleteRequest(struct _IRP *,char)\" (__imp_?IofCompleteRequest@@YIXPAU_IRP@@D@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall KeWaitForSingleObject(void *,enum _KWAIT_REASON,char,unsigned char,union _LARGE_INTEGER *)\" (__imp_?KeWaitForSingleObject@@YGJPAXW4_KWAIT_REASON@@DEPAT_
LARGE_INTEGER@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __fastcall IofCallDriver(struct _DEVICE_OBJECT *,struct _IRP *)\" (__imp_?IofCallDriver@@YIJPAU_DEVICE_OBJECT@@PAU_IRP@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) struct _IRP * __stdcall IoBuildDeviceIoControlRequest(unsigned long,struct _DEVICE_OBJECT *,void *,unsigned long,void *,unsigned long,unsigned char,struct _KEVENT *,st
ruct _IO_STATUS_BLOCK *)\" (__imp_?IoBuildDeviceIoControlRequest@@YGPAU_IRP@@KPAU_DEVICE_OBJECT@@PAXK1KEPAU_KEVENT@@PAU_IO_STATUS_BLOCK@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall KeInitializeEvent(struct _KEVENT *,enum _EVENT_TYPE,unsigned char)\" (__imp_?KeInitializeEvent@@YGXPAU_KEVENT@@W4_EVENT_TYPE@@E@Z)
objchk\\i386\\aiherong.sys() : error LNK1120: 14 unresolved externals
BUILD: Linking c:\\temp\\lasthope\\aiherong directory
Linking Executable - objchk\\i386\\aiherong.sys for i386
link() : error LNK2001: unresolved external symbol _DriverEntry@8
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall ObfDereferenceObject(void *)\" (__imp_?ObfDereferenceObject@@YIXPAX@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall IoDeleteDevice(struct _DEVICE_OBJECT *)\" (__imp_?IoDeleteDevice@@YGXPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoDeleteSymbolicLink(struct _UNICODE_STRING *)\" (__imp_?IoDeleteSymbolicLink@@YGJPAU_UNICODE_STRING@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoGetDeviceObjectPointer(struct _UNICODE_STRING *,unsigned long,struct _FILE_OBJECT * *,struct _DEVICE_OBJECT * *)\" (__imp_?IoGetDeviceObjectPointer@@YG
JPAU_UNICODE_STRING@@KPAPAU_FILE_OBJECT@@PAPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"unsigned long __cdecl DbgPrint(char *,...)\" (?DbgPrint@@YAKPADZZ)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateSymbolicLink(struct _UNICODE_STRING *,struct _UNICODE_STRING *)\" (__imp_?IoCreateSymbolicLink@@YGJPAU_UNICODE_STRING@@0@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall IoCreateDevice(struct _DRIVER_OBJECT *,unsigned long,struct _UNICODE_STRING *,unsigned long,unsigned long,unsigned char,struct _DEVICE_OBJECT * *)\" (__i
mp_?IoCreateDevice@@YGJPAU_DRIVER_OBJECT@@KPAU_UNICODE_STRING@@KKEPAPAU_DEVICE_OBJECT@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall RtlInitUnicodeString(struct _UNICODE_STRING *,unsigned short const *)\" (__imp_?RtlInitUnicodeString@@YGXPAU_UNICODE_STRING@@PBG@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __fastcall IofCompleteRequest(struct _IRP *,char)\" (__imp_?IofCompleteRequest@@YIXPAU_IRP@@D@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __stdcall KeWaitForSingleObject(void *,enum _KWAIT_REASON,char,unsigned char,union _LARGE_INTEGER *)\" (__imp_?KeWaitForSingleObject@@YGJPAXW4_KWAIT_REASON@@DEPAT_
LARGE_INTEGER@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) long __fastcall IofCallDriver(struct _DEVICE_OBJECT *,struct _IRP *)\" (__imp_?IofCallDriver@@YIJPAU_DEVICE_OBJECT@@PAU_IRP@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) struct _IRP * __stdcall IoBuildDeviceIoControlRequest(unsigned long,struct _DEVICE_OBJECT *,void *,unsigned long,void *,unsigned long,unsigned char,struct _KEVENT *,st
ruct _IO_STATUS_BLOCK *)\" (__imp_?IoBuildDeviceIoControlRequest@@YGPAU_IRP@@KPAU_DEVICE_OBJECT@@PAXK1KEPAU_KEVENT@@PAU_IO_STATUS_BLOCK@@@Z)
aiherong.obj() : error LNK2001: unresolved external symbol \"__declspec(dllimport) void __stdcall KeInitializeEvent(struct _KEVENT *,enum _EVENT_TYPE,unsigned char)\" (__imp_?KeInitializeEvent@@YGXPAU_KEVENT@@W4_EVENT_TYPE@@E@Z)
objchk\\i386\\aiherong.sys() : error LNK1120: 14 unresolved externals
BUILD: Done
    1 file compiled -     0 LPS
    2 executables built - 30 Errors
Error executing d:\\winnt\\system32\\cmd.exe.

aiherong.sys - 30 error(s), 0 warning(s)
tigerzd
驱动老牛
驱动老牛
  • 注册日期2001-08-25
  • 最后登录2004-12-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-07-12 10:11
试试:
#ifdef __cplusplus
extern \"C\"
{
#endif
#include \"wdm.h\"
#ifdef __cplusplus
}
#endif
犯强汉者,虽远必诛! [img]http://www.driverdevelop.com/forum/upload/tigerzd/2002-12-13_sf10.JPG[/img]
Tom.Cat
禁止发言
禁止发言
  • 注册日期2001-10-10
  • 最后登录2019-07-29
  • 粉丝1
  • 关注0
  • 积分-53792分
  • 威望197411点
  • 贡献值0点
  • 好评度5点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2002-07-12 11:24
用户被禁言,该主题自动屏蔽!
aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-07-12 12:14
谢谢!不过错误变成:
--------------------Configuration: ColdBad - Win32 Debug--------------------
Compiling...
Command line warning D4024 : unrecognized source file type \'CONDITION_HANDLING=1\', object file assumed
Command line warning D4027 : source file \'CONDITION_HANDLING=1\' ignored
aiherong.cpp
Linking...
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoDeleteSymbolicLink
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoGetDeviceObjectPointer
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoDeleteDevice
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoCreateSymbolicLink
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoCreateDevice
aiherong.obj : error LNK2001: unresolved external symbol __imp__KeWaitForSingleObject
aiherong.obj : error LNK2001: unresolved external symbol __imp__IoBuildDeviceIoControlRequest
aiherong.obj : error LNK2001: unresolved external symbol __imp__KeInitializeEvent
.\\i386\\checked\\aiherong.sys : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.

aiherong.sys - 9 error(s), 2 warning(s)
The following environment variables were not found
$(BASEDIR)
$(CPU)
$(DRIVERWORKS)
tigerzd
驱动老牛
驱动老牛
  • 注册日期2001-08-25
  • 最后登录2004-12-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-07-12 12:36
你是不是既有C又有C++文件啊?!
犯强汉者,虽远必诛! [img]http://www.driverdevelop.com/forum/upload/tigerzd/2002-12-13_sf10.JPG[/img]
aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-07-12 12:46
是我弄错了,不过错误变成:
--------------------Configuration: aiherong - Win32 Debug--------------------
New or updated MSVC detected.  Updating DDK environment....
Setting environment for using Microsoft Visual C++ tools.
Starting dirs creation...Completed.
BUILD: Object root set to: ==> objchk
BUILD: /i switch ignored
BUILD: Compile and Link for i386
BUILD: Loading c:\\NTDDK\\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Examining c:\\temp\\lasthope\\aiherong directory for files to compile.
    c:\\temp\\lasthope\\aiherong
    c:\\temp\\lasthope\\aiherong - 1 source files (0 lines)
BUILD: Compiling c:\\temp\\lasthope\\aiherong directory
Compiling - aiherong.cpp for i386
Linking Executable - objchk\\i386\\aiherong.sys for i386
link() : error LNK2001: unresolved external symbol _DriverEntry@8
objchk\\i386\\aiherong.sys() : error LNK1120: 1 unresolved externals
BUILD: Linking c:\\temp\\lasthope\\aiherong directory
Linking Executable - objchk\\i386\\aiherong.sys for i386
link() : error LNK2001: unresolved external symbol _DriverEntry@8
objchk\\i386\\aiherong.sys() : error LNK1120: 1 unresolved externals
BUILD: Done
    1 file compiled -     0 LPS
    2 executables built - 4 Errors
Error executing d:\\winnt\\system32\\cmd.exe.

aiherong.sys - 4 error(s), 0 warning(s)
aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2002-07-12 13:09
请TIGERZD大侠帮忙!
seaquester
驱动大牛
驱动大牛
  • 注册日期2002-05-22
  • 最后登录2016-06-16
  • 粉丝0
  • 关注0
  • 积分500分
  • 威望115点
  • 贡献值0点
  • 好评度107点
  • 原创分0分
  • 专家分52分
7楼#
发布于:2002-07-12 13:36
link() : error LNK2001: unresolved external symbol _DriverEntry@8
--------------------------------------
给DriverEntry添加一个声明
extern \"C\" ULONG DriverEntry(IN PVOID, IN PVOID);
八风舞遥翩,九野弄清音。 鸣高常向月,善舞不迎人。
aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2002-07-12 14:47
我的问题解决了,不知如何给帮助我的朋友们加分?怎么操作?
tigerzd
驱动老牛
驱动老牛
  • 注册日期2001-08-25
  • 最后登录2004-12-13
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
9楼#
发布于:2002-07-12 18:21
我的问题解决了,不知如何给帮助我的朋友们加分?怎么操作?

发贴上有给分按纽。
犯强汉者,虽远必诛! [img]http://www.driverdevelop.com/forum/upload/tigerzd/2002-12-13_sf10.JPG[/img]
aiherong
驱动牛犊
驱动牛犊
  • 注册日期2002-06-07
  • 最后登录2007-01-10
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2002-07-13 12:03
本人愚笨,还是找不到“给分”按钮在何处啊!
tjumark
驱动牛犊
驱动牛犊
  • 注册日期2003-12-02
  • 最后登录2004-04-27
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
11楼#
发布于:2004-04-23 20:30
我也有这个问题,还是解决不了。
Compiling...
T.c
Linking...
T.obj : error LNK2001: unresolved external symbol __imp__IoGetDeviceObjectPointer
T.obj : error LNK2001: unresolved external symbol __imp__RtlInitUnicodeString@8
Debug/T.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

T.exe - 3 error(s), 0 warning(s)

代码:#include<wdm.h>
#include <ntddk.h>
#include <stdio.h>
#include <parallel.h>
main()
{
NTSTATUS status;
PFILE_OBJECT PortFileObject;
PDEVICE_OBJECT PortDeviceObject;
UNICODE_STRING  PortDeviceObjectName;
RtlInitUnicodeString(&PortDeviceObjectName, L\"\\\\Device\\\\Parallel0\");
      
status = IoGetDeviceObjectPointer(
&PortDeviceObjectName,
FILE_ALL_ACCESS,
&PortFileObject,
&PortDeviceObject
);

if (!NT_SUCCESS(status)) {
printf(\"err\\n\");
}
}

我是新手,谢谢各位了。
ddvmailcheck9727332
游客

返回顶部