Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#5

Re: from ANSI_STRING to PAnsichar

  Alt 25. Okt 2009, 14:03
Thank you himitsu . i think i'm confused here :

What i wanted is :

i use the ANSI_STRING in a C project declared as follows :

Code:
typedef struct _SCANNER_REPLY {

       BOOLEAN SafeToOpen;
       ANSI_STRING FileName;
} SCANNER_REPLY, *PSCANNER_REPLY;
Only to print out the Current FileName exmp : c:\mytextfile.txt

so the result in c :
Code:
NTSTATUS status;
SCANNER_REPLY replyMessage;
status = RtlUnicodeStringToAnsiString(&replyMessage.FileName, &FileI->Name, TRUE);
   
   if (NT_SUCCESS( status )) {
        DbgPrint("Current File: %s\n", replyMessage.FileName.Buffer);
/*
 this will Print Out the Current FileName ** Current File: \Device\HarddiskVolume1\myfile.txt **
*/
        RtlFreeAnsiString(&replyMessage.FileName);
      }
and in Delphi i declared as follows :
Delphi-Quellcode:
_SCANNER_REPLY = record
SafeToOpen: BOOLEAN;
FileName:ANSI_STRING ; // ANSI_STRING is declared as in my 1st thread
end;
SCANNER_REPLY = _SCANNER_REPLY;
PSCANNER_REPLY = ^_SCANNER_REPLY;
But when i used your methode in your last reply P will print out the Whole FileName content Buffer , But i only need to print out the filename as in C result

any suggestion for that ?
  Mit Zitat antworten Zitat