syswin.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2008 by Florian Klaempfl and Pavel Ozerski
  4. member of the Free Pascal development team.
  5. FPC Pascal system unit part shared by win32/win64.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. Error code definitions for the Win32 API functions
  14. Values are 32 bit values layed out as follows:
  15. 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  16. 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  17. +---+-+-+-----------------------+-------------------------------+
  18. |Sev|C|R| Facility | Code |
  19. +---+-+-+-----------------------+-------------------------------+
  20. where
  21. Sev - is the severity code
  22. 00 - Success
  23. 01 - Informational
  24. 10 - Warning
  25. 11 - Error
  26. C - is the Customer code flag
  27. R - is a reserved bit
  28. Facility - is the facility code
  29. Code - is the facility's status code
  30. }
  31. const
  32. SEVERITY_SUCCESS = $00000000;
  33. SEVERITY_INFORMATIONAL = $40000000;
  34. SEVERITY_WARNING = $80000000;
  35. SEVERITY_ERROR = $C0000000;
  36. const
  37. STATUS_SEGMENT_NOTIFICATION = $40000005;
  38. DBG_TERMINATE_THREAD = $40010003;
  39. DBG_TERMINATE_PROCESS = $40010004;
  40. DBG_CONTROL_C = $40010005;
  41. DBG_CONTROL_BREAK = $40010008;
  42. STATUS_GUARD_PAGE_VIOLATION = $80000001;
  43. STATUS_DATATYPE_MISALIGNMENT = $80000002;
  44. STATUS_BREAKPOINT = $80000003;
  45. STATUS_SINGLE_STEP = $80000004;
  46. DBG_EXCEPTION_NOT_HANDLED = $80010001;
  47. STATUS_ACCESS_VIOLATION = $C0000005;
  48. STATUS_IN_PAGE_ERROR = $C0000006;
  49. STATUS_INVALID_HANDLE = $C0000008;
  50. STATUS_NO_MEMORY = $C0000017;
  51. STATUS_ILLEGAL_INSTRUCTION = $C000001D;
  52. STATUS_NONCONTINUABLE_EXCEPTION = $C0000025;
  53. STATUS_INVALID_DISPOSITION = $C0000026;
  54. STATUS_ARRAY_BOUNDS_EXCEEDED = $C000008C;
  55. STATUS_FLOAT_DENORMAL_OPERAND = $C000008D;
  56. STATUS_FLOAT_DIVIDE_BY_ZERO = $C000008E;
  57. STATUS_FLOAT_INEXACT_RESULT = $C000008F;
  58. STATUS_FLOAT_INVALID_OPERATION = $C0000090;
  59. STATUS_FLOAT_OVERFLOW = $C0000091;
  60. STATUS_FLOAT_STACK_CHECK = $C0000092;
  61. STATUS_FLOAT_UNDERFLOW = $C0000093;
  62. STATUS_INTEGER_DIVIDE_BY_ZERO = $C0000094;
  63. STATUS_INTEGER_OVERFLOW = $C0000095;
  64. STATUS_PRIVILEGED_INSTRUCTION = $C0000096;
  65. STATUS_STACK_OVERFLOW = $C00000FD;
  66. STATUS_CONTROL_C_EXIT = $C000013A;
  67. STATUS_FLOAT_MULTIPLE_FAULTS = $C00002B4;
  68. STATUS_FLOAT_MULTIPLE_TRAPS = $C00002B5;
  69. STATUS_REG_NAT_CONSUMPTION = $C00002C9;
  70. EXCEPTION_EXECUTE_HANDLER = 1;
  71. EXCEPTION_CONTINUE_EXECUTION = -1;
  72. EXCEPTION_CONTINUE_SEARCH = 0;
  73. CONTEXT_X86 = $00010000;
  74. CONTEXT_CONTROL = CONTEXT_X86 or $00000001;
  75. CONTEXT_INTEGER = CONTEXT_X86 or $00000002;
  76. CONTEXT_SEGMENTS = CONTEXT_X86 or $00000004;
  77. CONTEXT_FLOATING_POINT = CONTEXT_X86 or $00000008;
  78. CONTEXT_DEBUG_REGISTERS = CONTEXT_X86 or $00000010;
  79. CONTEXT_EXTENDED_REGISTERS = CONTEXT_X86 or $00000020;
  80. CONTEXT_FULL = CONTEXT_CONTROL or CONTEXT_INTEGER or CONTEXT_SEGMENTS;
  81. MAXIMUM_SUPPORTED_EXTENSION = 512;
  82. {*****************************************************************************
  83. Parameter Handling
  84. *****************************************************************************}
  85. procedure setup_arguments;
  86. var
  87. arglen,
  88. count : longint;
  89. argstart,
  90. pc,arg : pchar;
  91. quote : Boolean;
  92. argvlen : longint;
  93. buf: array[0..259] of char; // need MAX_PATH bytes, not 256!
  94. procedure allocarg(idx,len:longint);
  95. var
  96. oldargvlen : longint;
  97. begin
  98. if idx>=argvlen then
  99. begin
  100. oldargvlen:=argvlen;
  101. argvlen:=(idx+8) and (not 7);
  102. sysreallocmem(argv,argvlen*sizeof(pointer));
  103. fillchar(argv[oldargvlen],(argvlen-oldargvlen)*sizeof(pointer),0);
  104. end;
  105. { use realloc to reuse already existing memory }
  106. { always allocate, even if length is zero, since }
  107. { the arg. is still present! }
  108. sysreallocmem(argv[idx],len+1);
  109. end;
  110. begin
  111. { create commandline, it starts with the executed filename which is argv[0] }
  112. { Win32 passes the command NOT via the args, but via getmodulefilename}
  113. count:=0;
  114. argv:=nil;
  115. argvlen:=0;
  116. ArgLen := GetModuleFileName(0, @buf[0], sizeof(buf));
  117. buf[ArgLen] := #0; // be safe
  118. allocarg(0,arglen);
  119. move(buf,argv[0]^,arglen+1);
  120. { Setup cmdline variable }
  121. cmdline:=GetCommandLine;
  122. { process arguments }
  123. pc:=cmdline;
  124. {$IfDef SYSTEM_DEBUG_STARTUP}
  125. Writeln(stderr,'Win32 GetCommandLine is #',pc,'#');
  126. {$EndIf }
  127. while pc^<>#0 do
  128. begin
  129. { skip leading spaces }
  130. while pc^ in [#1..#32] do
  131. inc(pc);
  132. if pc^=#0 then
  133. break;
  134. { calc argument length }
  135. quote:=False;
  136. argstart:=pc;
  137. arglen:=0;
  138. while (pc^<>#0) do
  139. begin
  140. case pc^ of
  141. #1..#32 :
  142. begin
  143. if quote then
  144. inc(arglen)
  145. else
  146. break;
  147. end;
  148. '"' :
  149. if pc[1]<>'"' then
  150. quote := not quote
  151. else
  152. inc(pc);
  153. else
  154. inc(arglen);
  155. end;
  156. inc(pc);
  157. end;
  158. { copy argument }
  159. { Don't copy the first one, it is already there.}
  160. If Count<>0 then
  161. begin
  162. allocarg(count,arglen);
  163. quote:=False;
  164. pc:=argstart;
  165. arg:=argv[count];
  166. while (pc^<>#0) do
  167. begin
  168. case pc^ of
  169. #1..#32 :
  170. begin
  171. if quote then
  172. begin
  173. arg^:=pc^;
  174. inc(arg);
  175. end
  176. else
  177. break;
  178. end;
  179. '"' :
  180. if pc[1]<>'"' then
  181. quote := not quote
  182. else
  183. inc(pc);
  184. else
  185. begin
  186. arg^:=pc^;
  187. inc(arg);
  188. end;
  189. end;
  190. inc(pc);
  191. end;
  192. arg^:=#0;
  193. end;
  194. {$IfDef SYSTEM_DEBUG_STARTUP}
  195. Writeln(stderr,'dos arg ',count,' #',arglen,'#',argv[count],'#');
  196. {$EndIf SYSTEM_DEBUG_STARTUP}
  197. inc(count);
  198. end;
  199. { get argc }
  200. argc:=count;
  201. { free unused memory, leaving a nil entry at the end }
  202. sysreallocmem(argv,(count+1)*sizeof(pointer));
  203. argv[count] := nil;
  204. end;
  205. function paramcount : longint;
  206. begin
  207. paramcount := argc - 1;
  208. end;
  209. function paramstr(l : longint) : string;
  210. begin
  211. if (l>=0) and (l<argc) then
  212. paramstr:=strpas(argv[l])
  213. else
  214. paramstr:='';
  215. end;
  216. procedure randomize;
  217. begin
  218. randseed:=GetTickCount;
  219. end;
  220. Const
  221. DLL_PROCESS_ATTACH = 1;
  222. DLL_THREAD_ATTACH = 2;
  223. DLL_PROCESS_DETACH = 0;
  224. DLL_THREAD_DETACH = 3;
  225. DLLExitOK : boolean = true;
  226. Var
  227. DLLBuf : Jmp_buf;
  228. function Dll_entry{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}(const info : TEntryInformation){$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} : longbool; [public,alias:'_FPC_DLL_Entry'];
  229. begin
  230. {$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
  231. EntryInformation:=info;
  232. {$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
  233. IsLibrary:=true;
  234. Dll_entry:=false; { return value is ignored, except when DLLreason=DLL_PROCESS_ATTACH }
  235. case DLLreason of
  236. DLL_PROCESS_ATTACH :
  237. begin
  238. MainThreadIdWin32 := Win32GetCurrentThreadId;
  239. If SetJmp(DLLBuf) = 0 then
  240. begin
  241. {$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION}
  242. EntryInformation.PascalMain();
  243. {$else FPC_HAS_INDIRECT_MAIN_INFORMATION}
  244. PascalMain;
  245. {$endif FPC_HAS_INDIRECT_MAIN_INFORMATION}
  246. Dll_entry:=true;
  247. end
  248. else
  249. Dll_entry:=DLLExitOK;
  250. end;
  251. DLL_THREAD_ATTACH :
  252. begin
  253. { SysInitMultithreading must not be called here,
  254. see comments in exec_tls_callback below }
  255. { Allocate Threadvars }
  256. SysAllocateThreadVars;
  257. { NS : no idea what is correct to pass here - pass dummy value for now }
  258. { passing a dummy is ok, the correct value is read from the coff header of SysInstance (FK) }
  259. InitThread($1000000); { Assume everything is idempotent there, as the thread could have been created with BeginThread... }
  260. if assigned(Dll_Thread_Attach_Hook) then
  261. Dll_Thread_Attach_Hook(DllParam);
  262. end;
  263. DLL_THREAD_DETACH :
  264. begin
  265. if assigned(Dll_Thread_Detach_Hook) then
  266. Dll_Thread_Detach_Hook(DllParam);
  267. { Release Threadvars }
  268. if TlsGetValue(TLSKey)<>nil then
  269. DoneThread; { Assume everything is idempotent there }
  270. end;
  271. DLL_PROCESS_DETACH :
  272. begin
  273. if MainThreadIDWin32=0 then // already been here.
  274. exit;
  275. If SetJmp(DLLBuf) = 0 then
  276. FPC_Do_Exit;
  277. if assigned(Dll_Process_Detach_Hook) then
  278. Dll_Process_Detach_Hook(DllParam);
  279. SysReleaseThreadVars;
  280. { Free TLS resources used by ThreadVars }
  281. SysFiniMultiThreading;
  282. MainThreadIDWin32:=0;
  283. end;
  284. end;
  285. end;
  286. Procedure ExitDLL(Exitcode : longint);
  287. begin
  288. DLLExitOK:=ExitCode=0;
  289. LongJmp(DLLBuf,1);
  290. end;
  291. {$ifdef win64}
  292. {$include systlsdir.inc}
  293. {$endif win64}
  294. {****************************************************************************
  295. Error Message writing using messageboxes
  296. ****************************************************************************}
  297. function MessageBox(w1:longint;l1,l2:pointer;w2:longint):longint;
  298. stdcall;external 'user32' name 'MessageBoxA';
  299. const
  300. ErrorBufferLength = 1024;
  301. var
  302. ErrorBuf : array[0..ErrorBufferLength] of char;
  303. ErrorLen : SizeInt;
  304. Function ErrorWrite(Var F: TextRec): Integer;
  305. {
  306. An error message should always end with #13#10#13#10
  307. }
  308. var
  309. i : SizeInt;
  310. Begin
  311. while F.BufPos>0 do
  312. begin
  313. begin
  314. if F.BufPos+ErrorLen>ErrorBufferLength then
  315. i:=ErrorBufferLength-ErrorLen
  316. else
  317. i:=F.BufPos;
  318. Move(F.BufPtr^,ErrorBuf[ErrorLen],i);
  319. inc(ErrorLen,i);
  320. ErrorBuf[ErrorLen]:=#0;
  321. end;
  322. if ErrorLen=ErrorBufferLength then
  323. begin
  324. MessageBox(0,@ErrorBuf,pchar('Error'),0);
  325. ErrorLen:=0;
  326. end;
  327. Dec(F.BufPos,i);
  328. end;
  329. ErrorWrite:=0;
  330. End;
  331. Function ErrorClose(Var F: TextRec): Integer;
  332. begin
  333. if ErrorLen>0 then
  334. begin
  335. MessageBox(0,@ErrorBuf,pchar('Error'),0);
  336. ErrorLen:=0;
  337. end;
  338. ErrorLen:=0;
  339. ErrorClose:=0;
  340. end;
  341. Function ErrorOpen(Var F: TextRec): Integer;
  342. Begin
  343. TextRec(F).InOutFunc:=@ErrorWrite;
  344. TextRec(F).FlushFunc:=@ErrorWrite;
  345. TextRec(F).CloseFunc:=@ErrorClose;
  346. ErrorLen:=0;
  347. ErrorOpen:=0;
  348. End;
  349. procedure AssignError(Var T: Text);
  350. begin
  351. Assign(T,'');
  352. TextRec(T).OpenFunc:=@ErrorOpen;
  353. Rewrite(T);
  354. end;
  355. procedure SysInitStdIO;
  356. begin
  357. { Setup stdin, stdout and stderr, for GUI apps redirect stderr,stdout to be
  358. displayed in a messagebox }
  359. StdInputHandle:=longint(GetStdHandle(cardinal(STD_INPUT_HANDLE)));
  360. StdOutputHandle:=longint(GetStdHandle(cardinal(STD_OUTPUT_HANDLE)));
  361. StdErrorHandle:=longint(GetStdHandle(cardinal(STD_ERROR_HANDLE)));
  362. if not IsConsole then
  363. begin
  364. AssignError(stderr);
  365. AssignError(StdOut);
  366. Assign(Output,'');
  367. Assign(Input,'');
  368. Assign(ErrOutput,'');
  369. end
  370. else
  371. begin
  372. OpenStdIO(Input,fmInput,StdInputHandle);
  373. OpenStdIO(Output,fmOutput,StdOutputHandle);
  374. OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  375. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  376. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  377. end;
  378. end;
  379. { ProcessID cached to avoid repeated calls to GetCurrentProcess. }
  380. var
  381. ProcessID: SizeUInt;
  382. function GetProcessID: SizeUInt;
  383. begin
  384. GetProcessID := ProcessID;
  385. end;
  386. {******************************************************************************
  387. Unicode
  388. ******************************************************************************}
  389. const
  390. { MultiByteToWideChar }
  391. MB_PRECOMPOSED = 1;
  392. WC_NO_BEST_FIT_CHARS = $400;
  393. function MultiByteToWideChar(CodePage:UINT; dwFlags:DWORD; lpMultiByteStr:PChar; cchMultiByte:longint; lpWideCharStr:PWideChar;cchWideChar:longint):longint;
  394. stdcall; external 'kernel32' name 'MultiByteToWideChar';
  395. function WideCharToMultiByte(CodePage:UINT; dwFlags:DWORD; lpWideCharStr:PWideChar; cchWideChar:longint; lpMultiByteStr:PChar;cchMultiByte:longint; lpDefaultChar:PChar; lpUsedDefaultChar:pointer):longint;
  396. stdcall; external 'kernel32' name 'WideCharToMultiByte';
  397. function CharUpperBuff(lpsz:LPWSTR; cchLength:DWORD):DWORD;
  398. stdcall; external 'user32' name 'CharUpperBuffW';
  399. function CharLowerBuff(lpsz:LPWSTR; cchLength:DWORD):DWORD;
  400. stdcall; external 'user32' name 'CharLowerBuffW';
  401. procedure Win32Unicode2AnsiMove(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);
  402. var
  403. destlen: SizeInt;
  404. begin
  405. // retrieve length including trailing #0
  406. // not anymore, because this must also be usable for single characters
  407. destlen:=WideCharToMultiByte(cp, 0, source, len, nil, 0, nil, nil);
  408. // this will null-terminate
  409. setlength(dest, destlen);
  410. if destlen>0 then
  411. begin
  412. WideCharToMultiByte(cp, 0, source, len, @dest[1], destlen, nil, nil);
  413. PAnsiRec(pointer(dest)-AnsiFirstOff)^.CodePage:=cp;
  414. end;
  415. end;
  416. procedure Win32Ansi2UnicodeMove(source:pchar;cp : TSystemCodePage;var dest:UnicodeString;len:SizeInt);
  417. var
  418. destlen: SizeInt;
  419. dwflags: DWORD;
  420. begin
  421. // retrieve length including trailing #0
  422. // not anymore, because this must also be usable for single characters
  423. if cp=CP_UTF8 then
  424. dwFlags:=0
  425. else
  426. dwFlags:=MB_PRECOMPOSED;
  427. destlen:=MultiByteToWideChar(cp, dwFlags, source, len, nil, 0);
  428. // this will null-terminate
  429. setlength(dest, destlen);
  430. if destlen>0 then
  431. begin
  432. MultiByteToWideChar(cp, dwFlags, source, len, @dest[1], destlen);
  433. PUnicodeRec(pointer(dest)-UnicodeFirstOff)^.CodePage:=CP_UTF16;
  434. end;
  435. end;
  436. function Win32UnicodeUpper(const s : UnicodeString) : UnicodeString;
  437. begin
  438. result:=s;
  439. UniqueString(result);
  440. if length(result)>0 then
  441. CharUpperBuff(LPWSTR(result),length(result));
  442. end;
  443. function Win32UnicodeLower(const s : UnicodeString) : UnicodeString;
  444. begin
  445. result:=s;
  446. UniqueString(result);
  447. if length(result)>0 then
  448. CharLowerBuff(LPWSTR(result),length(result));
  449. end;
  450. {******************************************************************************
  451. Widestring
  452. ******************************************************************************}
  453. procedure Win32Ansi2WideMove(source:pchar;cp : TSystemCodePage;var dest:widestring;len:SizeInt);
  454. var
  455. destlen: SizeInt;
  456. dwFlags: DWORD;
  457. begin
  458. // retrieve length including trailing #0
  459. // not anymore, because this must also be usable for single characters
  460. if cp=CP_UTF8 then
  461. dwFlags:=0
  462. else
  463. dwFlags:=MB_PRECOMPOSED;
  464. destlen:=MultiByteToWideChar(cp, dwFlags, source, len, nil, 0);
  465. // this will null-terminate
  466. setlength(dest, destlen);
  467. if destlen>0 then
  468. MultiByteToWideChar(cp, dwFlags, source, len, @dest[1], destlen);
  469. end;
  470. function Win32WideUpper(const s : WideString) : WideString;
  471. begin
  472. result:=s;
  473. if length(result)>0 then
  474. CharUpperBuff(LPWSTR(result),length(result));
  475. end;
  476. function Win32WideLower(const s : WideString) : WideString;
  477. begin
  478. result:=s;
  479. if length(result)>0 then
  480. CharLowerBuff(LPWSTR(result),length(result));
  481. end;
  482. type
  483. PWStrInitEntry = ^TWStrInitEntry;
  484. TWStrInitEntry = record
  485. addr: PPointer;
  486. data: Pointer;
  487. end;
  488. PWStrInitTablesTable = ^TWStrInitTablesTable;
  489. TWStrInitTablesTable = packed record
  490. count : longint;
  491. tables : packed array [1..32767] of PWStrInitEntry;
  492. end;
  493. {$if not(defined(VER2_2) or defined(VER2_4))}
  494. var
  495. WStrInitTablesTable: TWStrInitTablesTable; external name 'FPC_WIDEINITTABLES';
  496. {$endif}
  497. function GetACP:UINT; stdcall; external 'kernel32' name 'GetACP';
  498. function GetConsoleCP:UINT; stdcall; external 'kernel32' name 'GetConsoleCP';
  499. function Win32GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
  500. begin
  501. case stdcp of
  502. scpAnsi: Result := GetACP;
  503. scpConsoleInput: Result := GetConsoleCP;
  504. scpConsoleOutput: Result := GetConsoleOutputCP;
  505. end;
  506. end;
  507. { there is a similiar procedure in sysutils which inits the fields which
  508. are only relevant for the sysutils units }
  509. procedure InitWin32Widestrings;
  510. var
  511. i: longint;
  512. ptable: PWStrInitEntry;
  513. begin
  514. {$if not(defined(VER2_2) or defined(VER2_4))}
  515. { assign initial values to global Widestring typed consts }
  516. for i:=1 to WStrInitTablesTable.count do
  517. begin
  518. ptable:=WStrInitTablesTable.tables[i];
  519. while Assigned(ptable^.addr) do
  520. begin
  521. fpc_widestr_assign(ptable^.addr^, ptable^.data);
  522. Inc(ptable);
  523. end;
  524. end;
  525. {$endif}
  526. { Note: since WideChar=UnicodeChar and PWideChar=PUnicodeChar,
  527. Wide2AnsiMoveProc is identical to Unicode2AnsiStrMoveProc. }
  528. { Widestring }
  529. widestringmanager.Wide2AnsiMoveProc:=@Win32Unicode2AnsiMove;
  530. widestringmanager.Ansi2WideMoveProc:=@Win32Ansi2WideMove;
  531. widestringmanager.UpperWideStringProc:=@Win32WideUpper;
  532. widestringmanager.LowerWideStringProc:=@Win32WideLower;
  533. { Unicode }
  534. widestringmanager.Unicode2AnsiMoveProc:=@Win32Unicode2AnsiMove;
  535. widestringmanager.Ansi2UnicodeMoveProc:=@Win32Ansi2UnicodeMove;
  536. widestringmanager.UpperUnicodeStringProc:=@Win32UnicodeUpper;
  537. widestringmanager.LowerUnicodeStringProc:=@Win32UnicodeLower;
  538. { Codepage }
  539. widestringmanager.GetStandardCodePageProc:=@Win32GetStandardCodePage;
  540. DefaultSystemCodePage:=GetACP;
  541. DefaultUnicodeCodePage:=CP_UTF16;
  542. end;