* Char -> AnsiChar

This commit is contained in:
Michael VAN CANNEYT 2022-12-22 11:50:44 +01:00 committed by Michaël Van Canneyt
parent ec8d82332a
commit f96476b4fc
8 changed files with 22 additions and 22 deletions

View File

@ -31,7 +31,7 @@ const
function RegistryPath: PNtUnicodeString; inline; function RegistryPath: PNtUnicodeString; inline;
function DriverObject: PDriverObject; inline; function DriverObject: PDriverObject; inline;
function DbgPrint(aFormat: PChar): LongWord; cdecl; varargs; external ntkrnl name 'DbgPrint'; function DbgPrint(aFormat: PAnsiChar): LongWord; cdecl; varargs; external ntkrnl name 'DbgPrint';
function PoolTag(aTag: TTagString): LongWord; function PoolTag(aTag: TTagString): LongWord;

View File

@ -93,7 +93,7 @@ procedure DeleteExtIO ();
begin begin
end; end;
function Createport(name : PChar; pri : longint): integer; function Createport(name : PAnsiChar; pri : longint): integer;
begin begin
result := -1; result := -1;
end; end;
@ -245,7 +245,7 @@ procedure AddDevice(str : String);
begin begin
end; end;
function MakeDeviceName(str : pchar): string; function MakeDeviceName(str : PAnsiChar): string;
begin begin
result := ''; result := '';
end; end;

View File

@ -23,7 +23,7 @@ type
PHANDLE = ^HANDLE; PHANDLE = ^HANDLE;
{ Upper-Case Versions of Some Standard C Types } { Upper-Case Versions of Some Standard C Types }
//CHAR = Char; //AnsiChar = AnsiChar;
SHORT = ShortInt; SHORT = ShortInt;
LONG = LongInt; LONG = LongInt;
//DOUBLE = Double; //DOUBLE = Double;

View File

@ -20,7 +20,7 @@ type
// Basic Types that aren't defined in User-Mode Headers // Basic Types that aren't defined in User-Mode Headers
// //
CINT = LongInt; // Int64 in 64 bit? CINT = LongInt; // Int64 in 64 bit?
PCSZ = PChar; PCSZ = PAnsiChar;
CLONG = ULONG; CLONG = ULONG;
CSHORT = SmallInt; CSHORT = SmallInt;
PCSHORT = ^CSHORT; PCSHORT = ^CSHORT;

View File

@ -27,7 +27,7 @@ procedure ShortStrToNTStr(aStr: ShortString; var aNTStr: UNICODE_STRING);
procedure AnsiStrToNTStr(const aStr: RawByteString; var aNTStr: UNICODE_STRING); procedure AnsiStrToNTStr(const aStr: RawByteString; var aNTStr: UNICODE_STRING);
procedure UnicodeStrToNtStr(const aStr: UnicodeString; procedure UnicodeStrToNtStr(const aStr: UnicodeString;
var aNTStr: UNICODE_STRING); var aNTStr: UNICODE_STRING);
procedure PCharToNTStr(aStr: PChar; aLen: Cardinal; var aNTStr: UNICODE_STRING); procedure PCharToNTStr(aStr: PAnsiChar; aLen: Cardinal; var aNTStr: UNICODE_STRING);
procedure FreeNTStr(var aNTStr: UNICODE_STRING); procedure FreeNTStr(var aNTStr: UNICODE_STRING);
// Wraps NtDisplayString for use with Write(Ln) // Wraps NtDisplayString for use with Write(Ln)
@ -81,7 +81,7 @@ begin
aNTStr.MaximumLength := aNTStr.Length; aNTStr.MaximumLength := aNTStr.Length;
end; end;
procedure PCharToNTStr(aStr: PChar; aLen: Cardinal; var aNTStr: UNICODE_STRING); procedure PCharToNTStr(aStr: PAnsiChar; aLen: Cardinal; var aNTStr: UNICODE_STRING);
var var
i: Integer; i: Integer;
begin begin
@ -111,14 +111,14 @@ begin
if (BufPos>0) then begin if (BufPos>0) then begin
if Boolean(UserData[1]) then begin if Boolean(UserData[1]) then begin
{ TODO : check why UTF8 prints garbage } { TODO : check why UTF8 prints garbage }
{len := Utf8ToUnicode(Nil, 0, PChar(BufPtr), BufPos); {len := Utf8ToUnicode(Nil, 0, PAnsiChar(BufPtr), BufPos);
ntstr.Length := len * 2; ntstr.Length := len * 2;
ntstr.MaximumLength := ntstr.Length; ntstr.MaximumLength := ntstr.Length;
ntstr.Buffer := GetMem(ntstr.Length); ntstr.Buffer := GetMem(ntstr.Length);
Utf8ToUnicode(ntstr.Buffer, len, PChar(BufPtr), BufPos);} Utf8ToUnicode(ntstr.Buffer, len, PAnsiChar(BufPtr), BufPos);}
PCharToNtStr(PChar(BufPtr), BufPos, ntstr); PCharToNtStr(PAnsiChar(BufPtr), BufPos, ntstr);
end else end else
PCharToNtStr(PChar(BufPtr), BufPos, ntstr); PCharToNtStr(PAnsiChar(BufPtr), BufPos, ntstr);
NtDisplayString(@ntstr); NtDisplayString(@ntstr);
// FreeNTStr uses FreeMem, so we don't need an If here // FreeNTStr uses FreeMem, so we don't need an If here
FreeNtStr(ntstr); FreeNtStr(ntstr);

View File

@ -358,7 +358,7 @@ begin
end; end;
end; end;
procedure SysPCharToNtStr(var aNtStr: TNtUnicodeString; aText: PChar; procedure SysPCharToNtStr(var aNtStr: TNtUnicodeString; aText: PAnsiChar;
aLen: LongWord); aLen: LongWord);
var var
i: Integer; i: Integer;

View File

@ -47,8 +47,8 @@ const
DriveSeparator = '\'; DriveSeparator = '\';
ExtensionSeparator = '.'; ExtensionSeparator = '.';
PathSeparator = ';'; PathSeparator = ';';
AllowDirectorySeparators : set of char = ['\']; AllowDirectorySeparators : set of AnsiChar = ['\'];
AllowDriveSeparators : set of char = []; AllowDriveSeparators : set of AnsiChar = [];
{ FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! } { FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
maxExitCode = High(ErrorCode); maxExitCode = High(ErrorCode);
@ -66,7 +66,7 @@ var
{ C compatible arguments } { C compatible arguments }
argc: LongWord; argc: LongWord;
argvw: PPWideChar; argvw: PPWideChar;
argv: PPChar; argv: PPAnsiChar;
const const
{ Default filehandles } { Default filehandles }
@ -112,7 +112,7 @@ var
count : longint; count : longint;
argstart, argstart,
pc,arg : pwidechar; pc,arg : pwidechar;
pc2 : pchar; pc2 : PAnsiChar;
quote : Boolean; quote : Boolean;
argvlen : longint; argvlen : longint;
params : PRTLUserProcessParameters; params : PRTLUserProcessParameters;
@ -145,7 +145,7 @@ begin
allocarg(0,arglen); allocarg(0,arglen);
move(params^.ImagePathName.Buffer^,argvw[0]^,arglen*sizeof(widechar)+1); move(params^.ImagePathName.Buffer^,argvw[0]^,arglen*sizeof(widechar)+1);
{ Setup cmdline variable } { Setup cmdline variable }
{ cmdline is a PChar, but NT uses PWideChar... don't set cmdline for now } { cmdline is a PAnsiChar, but NT uses PWideChar... don't set cmdline for now }
{$message warning 'cmdline is not set'} {$message warning 'cmdline is not set'}
// cmdline:=GetCommandLine; // cmdline:=GetCommandLine;
{ the first argument isn't the image file name, so start at 1 } { the first argument isn't the image file name, so start at 1 }
@ -238,7 +238,7 @@ begin
{$message warning 'Use UnicodeToUTF8 for argument conversion'} {$message warning 'Use UnicodeToUTF8 for argument conversion'}
while Ord(pc^) > 0 do begin while Ord(pc^) > 0 do begin
if word(pc^) < 127 then if word(pc^) < 127 then
pc2^ := Char(word(pc^)) pc2^ := AnsiChar(word(pc^))
else else
pc2^ := '?'; pc2^ := '?';
Inc(pc); Inc(pc);

View File

@ -718,7 +718,7 @@ Var
i: LongInt; i: LongInt;
dirinfo: POBJECT_DIRECTORY_INFORMATION; dirinfo: POBJECT_DIRECTORY_INFORMATION;
filedirinfo: PFILE_DIRECTORY_INFORMATION; filedirinfo: PFILE_DIRECTORY_INFORMATION;
pc: PChar; pc: PAnsiChar;
filename: UnicodeString; filename: UnicodeString;
iostatus: IO_STATUS_BLOCK; iostatus: IO_STATUS_BLOCK;
begin begin
@ -767,7 +767,7 @@ begin
DirName:='./' DirName:='./'
Else Else
DirName:=Copy(NTFindData^.SearchSpec,1,NTFindData^.NamePos); DirName:=Copy(NTFindData^.SearchSpec,1,NTFindData^.NamePos);
NTFindData^.DirPtr := fpopendir(Pchar(pointer(DirName))); NTFindData^.DirPtr := fpopendir(PAnsiChar(pointer(DirName)));
end;} end;}
SName := Copy(Rslt.FindData.SearchSpec, Rslt.FindData.NamePos + 1, SName := Copy(Rslt.FindData.SearchSpec, Rslt.FindData.NamePos + 1,
Length(Rslt.FindData.SearchSpec)); Length(Rslt.FindData.SearchSpec));
@ -1144,7 +1144,7 @@ begin
begin begin
len:=UnicodeToUTF8(Nil, hp, 0); len:=UnicodeToUTF8(Nil, hp, 0);
SetLength(s,len); SetLength(s,len);
UnicodeToUTF8(PChar(s), hp, len); UnicodeToUTF8(PAnsiChar(s), hp, len);
i:=pos('=',s); i:=pos('=',s);
if uppercase(copy(s,1,i-1))=upperenvvar then if uppercase(copy(s,1,i-1))=upperenvvar then
begin begin
@ -1192,7 +1192,7 @@ begin
{$else} {$else}
len:=UnicodeToUTF8(Nil, hp, 0); len:=UnicodeToUTF8(Nil, hp, 0);
SetLength(Result, len); SetLength(Result, len);
UnicodeToUTF8(PChar(Result), hp, len); UnicodeToUTF8(PAnsiChar(Result), hp, len);
SetCodePage(RawByteString(Result),CP_UTF8,false); SetCodePage(RawByteString(Result),CP_UTF8,false);
{$endif} {$endif}
end; end;