相关疑难解决方法(0)

将"\\?\"字符串添加到路径 - DriverPackageUninstall

我用过DriverPackageUninstall,卸载我的驱动程序.对于这个API,我需要提供"Inf Path"作为输入.我需要将此路径作为UNICODE字符串.为此,我从MSDN中获取以下声明作为参考.

对于Unicode字符串,最大长度为32,767个字符.如果使用Unicode版本,请在路径前添加"\?\"字符串.有关文件路径字符串格式的一般信息,请参阅在MSDN Library中命名文件.

但是当我在我的代码中尝试相同时它不起作用.有人可以给我一些关于如何在路径之前添加"\?\"的示例吗?谢谢..

更新:

我尝试使用以下代码作为示例

#define UNICODE
#define _UNIOCDE
#define WINVER 0x501

    #include <stdio.h>
    #include <windows.h>
    #include <tchar.h>

    int main () {
        PTCHAR DriverPackageInfPath = TEXT("\\?\\c:\\Documents and Settings\\Desktop\\My.inf");

        FILE * Log;
         Log = _wfopen( TEXT(DriverPackageInfPath, TEXT("a"));

         if ( Log == NULL ) {
           MessageBox(NULL, TEXT ( "Unable to open INF file\n" ),
               TEXT ( "Installation Error" ), 0 | MB_ICONSTOP );
           exit ( 1 );
         } else {
                printf ("INF file opened successfully\n");
         }

         return 0; …
Run Code Online (Sandbox Code Playgroud)

c unicode winapi wdk

1
推荐指数
1
解决办法
596
查看次数

标签 统计

c ×1

unicode ×1

wdk ×1

winapi ×1