Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.053 Beiträge
Delphi 12 Athens
|
AW: Wie, um den Code zu übersetzen C + + bis Delphi
5. Nov 2013, 10:00
Zitat von WIMGetImageInformation:
ppvImageInfo
[out] A pointer to a buffer that receives the address of the XML information about the volume image. When the function returns, this value contains the address of an allocated buffer, containing XML information about the volume image.
pcbImageInfo
[out] A pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the value of the ppvImageInfo parameter.
Remarks
When the function succeeds, then the data describing the image is in Unicode XML format. Use the LocalFree function to free the memory pointed to by the ppvImageInfo parameter when no longer needed.
Delphi-Quellcode:
var
created: DWORD; // Out-Parameter !!!!!!!!
var
FileHandle: THandle;
dwError: DWORD;
Size: Integer;
Buffer: PWideChar;
begin
Memo1.Clear;
InitWIMGAPI;
FileHandle := WIMCreateFile(
//PWideChar('d:\Wim_Image\x86\sources\install.wim'),
PWideChar('C:\Windows\winsxs\amd64_microsoft-windows-setup-component_31bf3856ad364e35_6.1.7601.17514_none_905283bdc3e1d2d8\FirstUXRes.WIM'),
WIM_GENERIC_READ, WIM_OPEN_EXISTING, WIM_FLAG_SHARE_WRITE,
WIM_COMPRESS_XPRESS,
@created); // or "nil);"
case created of
WIM_CREATED_NEW:
Memo1.Lines.Add('Created New');
WIM_OPENED_EXISTING:
Memo1.Lines.Add('Opend Existing');
//else
// Memo1.Lines.Add('Unknown Created Code ' + IntToStr(created));
end;
if FileHandle = 0 then
begin
dwError := GetLastError;
Memo1.Lines.Add('Error Open ' + IntToStr(dwError));
end
else
begin
//Size := 10000; // Out-Parameter
//GetMem(Buffer, Size); // Out-Parameter
if not WIMGetImageInformation(FileHandle, @Buffer, @Size) Then
begin
dwError := GetLastError;
Memo1.Lines.Add('Error Info ' + IntToStr(dwError));
end
else
begin
Memo1.Lines.Add('Info Size ' + IntToStr(Size));
Memo1.Lines.Add('');
Memo1.Lines.Add(Buffer);
WIMCloseHandle(FileHandle);
LocalFree(HLOCAL(Buffer)); // allocated by WIMGetImageInformation
end;
end;
end;
Neuste Erkenntnis:
Seit Pos einen dritten Parameter hat,
wird PoSex im Delphi viel seltener praktiziert.
|
|
Zitat
|