阅读:2084回复:8
XP Win32 调用DDk中的函数,如SetupDiXXX出现了问题,亟待解决!!!救命啊~~~~
c:\winddk\2600\inc\ddk\wdm\wxp\wdm.h(24) : fatal error C1189: #error : Compiler version not supported by Windows DDK
在VC++的头文件包含setupapi.h时,一开始系统提示找不到,我用了绝对路径:"C:\WinDDK\...\setupapi.h",然后就出现了上面的错误,说我的编译器版本不被DDK支持 这是怎么回事? 我该怎么办??? 很着急 先谢谢啦 |
|
沙发#
发布于:2007-05-27 09:27
win32 不要调用ddk中的函数
|
|
|
板凳#
发布于:2007-05-27 13:55
HANDLE GetDeviceViaInterface(GUID* pGuid,DWORD instance)
{ //get handle to relevant device info set //返回当前存在的GUID的设备接口的信息集。 HDEVINFO info=SetupDiGetClassDevs((LPGUID)pGuid,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); if(info==INVALID_HANDLE_VALUE) { return NULL; } //Get interface data for the requested instance SP_DEVICE_INTERFACE_DATA ifdata; ifdata.cbSize=sizeof(SP_DEVICE_INTERFACE_DATA); if(!SetupDiEnumDeviceInterfaces(info,NULL,pGuid,instance,&ifdata)) { SetupDiDestroyDeviceInfoList(info); Return NULL; } //Get size of symbolic Link name DWORD ReqLen; SetupDiGetDeviceInterfaceDetail(info,&ifdata,NULL,0,&ReqLen,NULL); PSP_DEVICE_INTERFACE_DETAIL_DATA ifDetail = ( PSP_DEVICE_INTERFACE_DETAIL_DATA)(new char[ReqLen]); if(ifDetail==NULL) { SetupDiDestroyDeviceInfoList(info); return NULL; } ifDetail->cbSize=sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA ifDetail); if(!SetupDiGetDeviceInterfaceDetail(info,&ifdata,ifDetail,ReqLen,NULL,NULL)) { SetupDiDestroyDeviceInfoList(info); delete ifDetail; return NULL; } //finally We can access to the Device; HANDLE ry=CreateFile(ifDetail-> DevicePath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL); if(ry==INVALID_HANDLE_VALUE) { } delete ifDetail; setupDiDestroyDeviceInfoList(info); return ry; } 上面这个函数用于打开设备句柄,这段函数我该怎么编译呢? 我现在的做法是直接考到VC++的某个CPP内,然后编译,如果不这么用,该怎么办呢? 麻烦驱网管理员帮帮我好么? |
|
地板#
发布于:2007-05-28 02:43
引用第2楼limingli_tmy于2007-05-27 13:55发表的 : 不用调DDK,用SDK就可以用SetupDixxx系列函数了,装个vc.net或vc 2005应该都行。VC6的话得另装SDK。 |
|
|
地下室#
发布于:2007-05-28 08:07
好 晓得了 我先弄个SDK试试 谢谢
|
|
5楼#
发布于:2007-05-28 08:11
是用 平台SDK 装好之后 就用VC++ 再调用就好了么?
|
|
6楼#
发布于:2007-05-28 08:22
我还有一种想法,我想把该函数在DDK下编译成一种文件 然后连接到VC++的工程里面这样行么? 可是我不会,希望试过的大牛给指点一下...谢谢啦
|
|
7楼#
发布于:2007-05-28 11:03
找了一上午了,大牛们,装了VC++了,再装SDK然后怎么配置?
Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK By Brian Johnson, Microsoft Corporation You can use Visual C++ Express to build powerful .NET Framework applications immediately after installation. In order to use Visual C++ Express to build Win32 applications, you'll need to take just a few more steps. I'll list the steps necessary for building Win32 applications using Visual C++ Express. Step 1: Install Visual C++ Express. If you haven't done so already, install Visual C++ Express. Step 2: Install the Microsoft Platform SDK. Install the Platform SDK over the Web from the Download Center. Follow the instructions and install the SDK for the x86 platform. Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box. Add the paths to the appropriate subsection: Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib Note: Alternatively, you can update the Visual C++ Directories by modifying the VCProjectEngine.dll.express.config file located in the \vc\vcpackages subdirectory of the Visual C++ Express install location. Please make sure that you also delete the file "vccomponents.dat" located in the "%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0" if it exists before restarting Visual C++ Express Edition. Step 4: Update the corewin_express.vsprops file. One more step is needed to make the Win32 template work in Visual C++ Express. You need to edit the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and Change the string that reads: AdditionalDependencies="kernel32.lib" to AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" Step 5: Generate and build a Win32 application to test your paths. In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file AppSettings.htm file located in the folder “%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\". In a text editor comment out lines 441 - 444 by putting a // in front of them as shown here: // WIN_APP.disabled = true; // WIN_APP_LABEL.disabled = true; // DLL_APP.disabled = true; // DLL_APP_LABEL.disabled = true; Save and close the file and open Visual C++ Express. From the File menu, click New Project. In the New Project dialog box, expand the Visual C++ node in the Product Types tree and then click Win32. Click on the Win32 Console Application template and then give your project a name and click OK. In the Win32 Application Wizard dialog box, make sure that Windows application is selected as the Application type and the ATL is not selected. Click the Finish button to generate the project. As a final step, test your project by clicking the Start button in the IDE or by pressing F5. Your Win32 application should build and run. 按照这个配置可以么? |
|
8楼#
发布于:2007-11-03 04:11
按照这个没有问题
|
|