Einzelnen Beitrag anzeigen

Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#15

Re: [Delphi] ASM => applicationdata

  Alt 6. Mär 2008, 17:23
So hier .. die dummen Strings mit PChar ersetzt und bisschen optimiert. Ohne Strings ist es sehr einfach:

Delphi-Quellcode:
function GetShellFolder(CSIDL: Integer): PChar;
var
  PIDL: PItemIdList;
  SystemFolder: Integer;
asm
  mov eax, CSIDL
  mov SystemFolder, eax
  lea eax, PIDL
  push eax
  push SystemFolder
  push 0
  call SHGetSpecialFolderLocation
  push eax
  call SUCCEEDED
  cmp eax, 0
  je @@ExitProc
  push MAX_PATH
  push GPTR
  call GlobalAlloc
  push eax
  call GlobalLock
  mov Result, eax
  push Result
  push PIDL
  call SHGetPathFromIDList
  @@ExitProc:
end;
  Mit Zitat antworten Zitat