Changeset 123 for Common/UCommon.pas
- Timestamp:
- Jan 5, 2011, 4:18:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r31 r123 4 4 5 5 uses 6 Windows, SysUtils, ShFolder, ShellAPI;6 Windows, Classes, SysUtils, SpecializedList; //, ShFolder, ShellAPI; 7 7 8 8 type … … 10 10 TArrayOfString = array of string; 11 11 12 function DelTree(DirName : string): Boolean; 12 TUserNameFormat = ( 13 unfNameUnknown = 0, // Unknown name type. 14 unfNameFullyQualifiedDN = 1, // Fully qualified distinguished name 15 unfNameSamCompatible = 2, // Windows NT® 4.0 account name 16 unfNameDisplay = 3, // A "friendly" display name 17 unfNameUniqueId = 6, // GUID string that the IIDFromString function returns 18 unfNameCanonical = 7, // Complete canonical name 19 unfNameUserPrincipal = 8, // User principal name 20 unfNameCanonicalEx = 9, 21 unfNameServicePrincipal = 10, // Generalized service principal name 22 unfDNSDomainName = 11); 23 24 13 25 function IntToBin(Data: Cardinal; Count: Byte): string; 14 26 function TryHexToInt(Data: string; var Value: Integer): Boolean; 15 27 function TryBinToInt(Data: string; var Value: Integer): Boolean; 16 function GetSpecialFolderPath(Folder: Integer): string; 28 //function DelTree(DirName : string): Boolean; 29 //function GetSpecialFolderPath(Folder: Integer): string; 17 30 function BCDToInt(Value: Byte): Byte; 18 31 function CompareByteArray(Data1, Data2: TArrayOfByte): Boolean; 19 32 function GetUserName: string; 33 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 20 34 function SplitString(var Text: string; Count: Word): string; 21 35 function GetBit(Variable: QWord; Index: Byte): Boolean; … … 27 41 implementation 28 42 29 function DelTree(DirName : string): Boolean;43 (*function DelTree(DirName : string): Boolean; 30 44 var 31 45 SHFileOpStruct : TSHFileOpStruct; … … 49 63 Result := False; 50 64 end; 51 end; 65 end;*) 52 66 53 67 function BCDToInt(Value: Byte): Byte; … … 56 70 end; 57 71 58 function GetSpecialFolderPath(Folder: Integer): string;72 (*function GetSpecialFolderPath(Folder: Integer): string; 59 73 const 60 74 SHGFP_TYPE_CURRENT = 0; … … 67 81 else 68 82 Result := ''; 69 end; 83 end;*) 70 84 71 85 function IntToBin(Data: Cardinal; Count: Byte): string; … … 158 172 end; 159 173 174 procedure GetUserNameEx(NameFormat: DWORD; 175 lpNameBuffer: LPSTR; nSize: PULONG); stdcall; 176 external 'secur32.dll' Name 'GetUserNameExA'; 177 178 179 function LoggedOnUserNameEx(Format: TUserNameFormat): string; 180 var 181 UserName: array[0..250] of Char; 182 Size: DWORD; 183 begin 184 Size := 250; 185 GetUserNameEx(Integer(Format), @UserName, @Size); 186 Result := UTF8Encode(UserName); 187 end; 188 160 189 function SplitString(var Text: string; Count: Word): string; 161 190 begin
Note:
See TracChangeset
for help on using the changeset viewer.