Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

c++ - 如何使WNetGetProviderName起作用?(How to make a WNetGetProviderName works?)

I found this code to detect VirtualBox virtual machine in C++ way , in its 9th method we have these :

(我发现此代码以C ++方式检测VirtualBox虚拟机,在其第9种方法中,我们具有以下功能:)

   unsigned long pnsize=0x1000;
   char* provider=(char*)LocalAlloc(LMEM_ZEROINIT,pnsize);
   int retv=WNetGetProviderName(WNNC_NET_RDR2SAMPLE,provider,&pnsize);
   if(retv==NO_ERROR)
   {
    if(lstrcmpi(provider,"VirtualBox Shared Folders")==0)
    {
        MessageBox(0,"VirtualBox detected","waliedassar",0);
        ExitProcess(9);
    }
   }

And i found MSDN page for WNetGetProviderNameA so i added #include <winnetwk.h> but i get compiler error in Linux MingW cross compiler and in Windows MS Visual Studio , they said that symbol WNetGetProviderNameA@12 can't be found or undefined reference error.

(我找到了WNetGetProviderNameA的 MSDN页面,所以我添加了#include <winnetwk.h>但是在Linux MingW交叉编译器和Windows MS Visual Studio中遇到编译器错误,他们说找不到WNetGetProviderNameA @ 12符号或未定义引用错误。 。)

I couldn't found the library associated with that symbol and no example of its use, Is there any way i can fix it and make it work just for this specific function?

(我找不到与该符号关联的库,也没有该符号的使用示例,有什么办法可以修复它并使之仅用于此特定功能?)

PS : other functions in that sample code, works just fine.

(PS :该示例代码中的其他功能也很好用。)

  ask by malloc translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...