请将下面的delphi code转换为C语言版的 thx,该如何处理

请将下面的delphi code转换为C语言版的 thx
C/C++ code

program Project1; 
{$APPTYPE CONSOLE} 
uses
Windows;

type
TSfcList = record 
wcsFileNameInDllCache: PWideChar; // Name of the file in DllCache 
wcsFilePath: PWideChar; // Path of the protected file 
wcsWhatEverInfFile: PWideChar; // Name of some INF file ... unknown meaning
end; 
TSfcListArray = array[0..0] of TSfcList; 
PSfcListArray = ^TSfcListArray; 

function SfcGetFiles( 
var lpNamelist: PSfcListArray; 
var lpNumEntries: DWORD 
): DWORD; stdcall; external 'sfcfiles.dll'; 
(* Call and then iterate through the array with wide strings NumEntries times. *) 

var 
namelist:PSfcListArray; 
i, num:DWORD; 
begin 
{ This crappy example simply dumps all SFC protected files to the console } 
if SfcGetFiles(namelist, num)=ERROR_SUCCESS then 
for i:=0 to num-1 do 
Writeln(String(namelist^[i].wcsFilePath));
end;

end.



------解决方案--------------------
C/C++ code

    typedef struct TSfcList
    {
        CString  wcsFileNameInDllCache; // Name of the file in DllCache 
        CString  wcsFilePath;           // Path of the protected file 
        CString  wcsWhatEverInfFile;    // Name of some INF file ... unknown meaning    
    }PSfcListArray;
    
    PSfcListArray namelist[10];  
    DWORD i, num; 
    
    
    HINSTANCE hDllInst = LoadLibrary("sfcfiles.dll");
    if(hDllInst)
    {
        typedef DWORD (WINAPI *MYFUNC)(PSfcListArray*, DWORD);    
        MYFUNC lpSfcGetFiles = NULL; // youFuntionNameAlias º¯Êý±ðÃû    
        lpSfcGetFiles = (MYFUNC)GetProcAddress(hDllInst,"SfcGetFiles");
        // youFuntionName ÔÚDLLÖÐÉùÃ÷µÄº¯ÊýÃû
        if(lpSfcGetFiles)
        {
            if (lpSfcGetFiles(namelist, num) == TRUE) 
            {
                for (i=0 ; i< (num-1); i++)
                {

                    //WriteLn(namelist[i].wcsFilePath);
                                        //这个貌似是写文件的函数,可以调用VC 里面的写文件函数:
                                         //CStdioFile file;
    //file.Open(_T("c:\\1.txt"),CFile::modeCreate|CFile::modeReadWrite);
    //file.WriteString(namelist[i].wcsFilePath);

                }
            }
        }
        
        FreeLibrary(hDllInst);
        
    }

------解决方案--------------------
修改一下 #1楼的
 
C/C++ code
 #include <windows.h>
 #include <stdio.h>
 #include <tchar.h>
 
 typedef struct _SfcList
{
     LPWSTR  wcsFileNameInDllCache; // Name of the file in DllCache 
     LPWSTR  wcsFilePath;           // Path of the protected file 
     LPWSTR  wcsWhatEverInfFile;    // Name of some INF file ... unknown meaning    
}SfcList, *PSfcListArray;

PSfcListArray namelist;
DWORD i, num; 
HINSTANCE hDllInst = LoadLibrary(_T("sfcfiles.dll"));
    if(hDllInst)
    {
        typedef DWORD (WINAPI *MYFUNC)(PSfcListArray*, DWORD*);    
        MYFUNC lpSfcGetFiles = NULL;
        lpSfcGetFiles = (MYFUNC)GetProcAddress(hDllInst,"SfcGetFiles");
        if(lpSfcGetFiles)
        {
            if (lpSfcGetFiles(&namelist, &num) == ERROR_SUCCESS) 
            {
                for (i=0 ; i< num; i++)
                {
                     wprintf("%s\n", namelist[i].wcsFilePath);
                }
            }
        }        
        FreeLibrary(hDllInst);        
    }