mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-31 18:22:32 +02:00
* Char -> AnsiChar
This commit is contained in:
parent
ec8d82332a
commit
f96476b4fc
@ -31,7 +31,7 @@ const
|
||||
function RegistryPath: PNtUnicodeString; 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;
|
||||
|
||||
|
@ -93,7 +93,7 @@ procedure DeleteExtIO ();
|
||||
begin
|
||||
end;
|
||||
|
||||
function Createport(name : PChar; pri : longint): integer;
|
||||
function Createport(name : PAnsiChar; pri : longint): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
@ -245,7 +245,7 @@ procedure AddDevice(str : String);
|
||||
begin
|
||||
end;
|
||||
|
||||
function MakeDeviceName(str : pchar): string;
|
||||
function MakeDeviceName(str : PAnsiChar): string;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
@ -23,7 +23,7 @@ type
|
||||
PHANDLE = ^HANDLE;
|
||||
|
||||
{ Upper-Case Versions of Some Standard C Types }
|
||||
//CHAR = Char;
|
||||
//AnsiChar = AnsiChar;
|
||||
SHORT = ShortInt;
|
||||
LONG = LongInt;
|
||||
//DOUBLE = Double;
|
||||
|
@ -20,7 +20,7 @@ type
|
||||
// Basic Types that aren't defined in User-Mode Headers
|
||||
//
|
||||
CINT = LongInt; // Int64 in 64 bit?
|
||||
PCSZ = PChar;
|
||||
PCSZ = PAnsiChar;
|
||||
CLONG = ULONG;
|
||||
CSHORT = SmallInt;
|
||||
PCSHORT = ^CSHORT;
|
||||
|
@ -27,7 +27,7 @@ procedure ShortStrToNTStr(aStr: ShortString; var aNTStr: UNICODE_STRING);
|
||||
procedure AnsiStrToNTStr(const aStr: RawByteString; var aNTStr: UNICODE_STRING);
|
||||
procedure UnicodeStrToNtStr(const aStr: UnicodeString;
|
||||
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);
|
||||
|
||||
// Wraps NtDisplayString for use with Write(Ln)
|
||||
@ -81,7 +81,7 @@ begin
|
||||
aNTStr.MaximumLength := aNTStr.Length;
|
||||
end;
|
||||
|
||||
procedure PCharToNTStr(aStr: PChar; aLen: Cardinal; var aNTStr: UNICODE_STRING);
|
||||
procedure PCharToNTStr(aStr: PAnsiChar; aLen: Cardinal; var aNTStr: UNICODE_STRING);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -111,14 +111,14 @@ begin
|
||||
if (BufPos>0) then begin
|
||||
if Boolean(UserData[1]) then begin
|
||||
{ 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.MaximumLength := ntstr.Length;
|
||||
ntstr.Buffer := GetMem(ntstr.Length);
|
||||
Utf8ToUnicode(ntstr.Buffer, len, PChar(BufPtr), BufPos);}
|
||||
PCharToNtStr(PChar(BufPtr), BufPos, ntstr);
|
||||
Utf8ToUnicode(ntstr.Buffer, len, PAnsiChar(BufPtr), BufPos);}
|
||||
PCharToNtStr(PAnsiChar(BufPtr), BufPos, ntstr);
|
||||
end else
|
||||
PCharToNtStr(PChar(BufPtr), BufPos, ntstr);
|
||||
PCharToNtStr(PAnsiChar(BufPtr), BufPos, ntstr);
|
||||
NtDisplayString(@ntstr);
|
||||
// FreeNTStr uses FreeMem, so we don't need an If here
|
||||
FreeNtStr(ntstr);
|
||||
|
@ -358,7 +358,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SysPCharToNtStr(var aNtStr: TNtUnicodeString; aText: PChar;
|
||||
procedure SysPCharToNtStr(var aNtStr: TNtUnicodeString; aText: PAnsiChar;
|
||||
aLen: LongWord);
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -47,8 +47,8 @@ const
|
||||
DriveSeparator = '\';
|
||||
ExtensionSeparator = '.';
|
||||
PathSeparator = ';';
|
||||
AllowDirectorySeparators : set of char = ['\'];
|
||||
AllowDriveSeparators : set of char = [];
|
||||
AllowDirectorySeparators : set of AnsiChar = ['\'];
|
||||
AllowDriveSeparators : set of AnsiChar = [];
|
||||
|
||||
{ FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
|
||||
maxExitCode = High(ErrorCode);
|
||||
@ -66,7 +66,7 @@ var
|
||||
{ C compatible arguments }
|
||||
argc: LongWord;
|
||||
argvw: PPWideChar;
|
||||
argv: PPChar;
|
||||
argv: PPAnsiChar;
|
||||
|
||||
const
|
||||
{ Default filehandles }
|
||||
@ -112,7 +112,7 @@ var
|
||||
count : longint;
|
||||
argstart,
|
||||
pc,arg : pwidechar;
|
||||
pc2 : pchar;
|
||||
pc2 : PAnsiChar;
|
||||
quote : Boolean;
|
||||
argvlen : longint;
|
||||
params : PRTLUserProcessParameters;
|
||||
@ -145,7 +145,7 @@ begin
|
||||
allocarg(0,arglen);
|
||||
move(params^.ImagePathName.Buffer^,argvw[0]^,arglen*sizeof(widechar)+1);
|
||||
{ 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'}
|
||||
// cmdline:=GetCommandLine;
|
||||
{ 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'}
|
||||
while Ord(pc^) > 0 do begin
|
||||
if word(pc^) < 127 then
|
||||
pc2^ := Char(word(pc^))
|
||||
pc2^ := AnsiChar(word(pc^))
|
||||
else
|
||||
pc2^ := '?';
|
||||
Inc(pc);
|
||||
|
@ -718,7 +718,7 @@ Var
|
||||
i: LongInt;
|
||||
dirinfo: POBJECT_DIRECTORY_INFORMATION;
|
||||
filedirinfo: PFILE_DIRECTORY_INFORMATION;
|
||||
pc: PChar;
|
||||
pc: PAnsiChar;
|
||||
filename: UnicodeString;
|
||||
iostatus: IO_STATUS_BLOCK;
|
||||
begin
|
||||
@ -767,7 +767,7 @@ begin
|
||||
DirName:='./'
|
||||
Else
|
||||
DirName:=Copy(NTFindData^.SearchSpec,1,NTFindData^.NamePos);
|
||||
NTFindData^.DirPtr := fpopendir(Pchar(pointer(DirName)));
|
||||
NTFindData^.DirPtr := fpopendir(PAnsiChar(pointer(DirName)));
|
||||
end;}
|
||||
SName := Copy(Rslt.FindData.SearchSpec, Rslt.FindData.NamePos + 1,
|
||||
Length(Rslt.FindData.SearchSpec));
|
||||
@ -1144,7 +1144,7 @@ begin
|
||||
begin
|
||||
len:=UnicodeToUTF8(Nil, hp, 0);
|
||||
SetLength(s,len);
|
||||
UnicodeToUTF8(PChar(s), hp, len);
|
||||
UnicodeToUTF8(PAnsiChar(s), hp, len);
|
||||
i:=pos('=',s);
|
||||
if uppercase(copy(s,1,i-1))=upperenvvar then
|
||||
begin
|
||||
@ -1192,7 +1192,7 @@ begin
|
||||
{$else}
|
||||
len:=UnicodeToUTF8(Nil, hp, 0);
|
||||
SetLength(Result, len);
|
||||
UnicodeToUTF8(PChar(Result), hp, len);
|
||||
UnicodeToUTF8(PAnsiChar(Result), hp, len);
|
||||
SetCodePage(RawByteString(Result),CP_UTF8,false);
|
||||
{$endif}
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user