PDA

Ver la Versión Completa : Imagex, WIMGAPI.DLL y Delphi


ArielMendoza
06-07-2007, 14:55:24
Hola a todos,

No se si esto le interesa a alguien, pero he buscado en Internet y no he encontrado nada para delphi.

Necesitaba aplicar una imagen WIM desde mi aplicación. Investigando con el WinDebuger y con Google encontré las declaraciones de las funciones. Me falta obtener el progreso que lo haré el lunes. Si ha alguien le interesa que me lo diga y pongo el código, o si alguien ya lo tiene mejor.

Un saludo a todos,

Ariel



Function WIMApplyImage(hImage:thandle; lpszPath:widestring;dzApplyFlags:cardinal):LongBool; stdcall; external 's:\tools\WIMGAPI.DLL';
function WIMCreateFile(lpszWimPath:widestring;dwDesiredAccess:Longint;dwCreationDisposition:Longint;dwFlagsAn dAttributes:Longint;dwCompressionType:Longint;var lpdwCreationResult:Longint):THandle; stdcall; external 's:\tools\WIMGAPI.DLL';
Function WIMSetTemporaryPath(hWnd:THandle;TemporaryPath:widestring):Integer;stdcall; external 's:\tools\WIMGAPI.DLL';
Function WIMLoadImage(hWnd:THandle;ImageIndex:longint):THandle;stdcall; external 's:\tools\WIMGAPI.DLL';
Function WIMCloseHandle(Handle:Thandle):longbool; stdcall; external 's:\tools\WIMGAPI.DLL';
Implementation
{$R *.dfm}
const WIM_GENERIC_READ = $80000000;
const WIM_GENERIC_WRITE = $40000000;
const WIM_CREATE_NEW = 1;
const WIM_CREATE_ALWAYS = 2;
const WIM_OPEN_EXISTING = 3;
const WIM_OPEN_ALWAYS = 4;
const WIM_COMPRESS_NONE = 0;
const WIM_COMPRESS_XPRESS = 1;
const WIM_COMPRESS_LZX = 2;
const WIM_CREATED_NEW = 0;
const WIM_OPENED_EXISTING = 1;
const WIM_FLAG_VERIFY = $00000002;

procedure TForm1.Button1Click(Sender: TObject);
var Created:integer;
hImage,ptrImageHandle:THandle;
intResult:boolean;
begin
hImage:=WIMCreateFile(pchar('S:\IMAGEN\WINXP32.WIM'),WIM_GENERIC_READ, WIM_OPEN_EXISTING, WIM_FLAG_VERIFY, WIM_COMPRESS_NONE, created);
WIMSetTemporaryPath(hImage, pchar('C:\Temp'));
ptrImageHandle := WIMLoadImage(hImage, 1);
intResult := WIMApplyImage(ptrImageHandle, pchar('C:\Temp'), 0);
showmessage(SysErrorMessage(getlasterror));
WIMCloseHandle(ptrImageHandle);
WIMCloseHandle(hImage);
end;

dec
06-07-2007, 16:35:44
Hola,


Puedes editar el mensaje y corregirlo.


Tú mismo puedes editar el mensaje y corregirlo. :)

ArielMendoza
11-07-2007, 11:12:44
Al final me hecho una DLL en C++ que le envia mensages al formulario con el progreso.


function ApplyImage(ImagePath:pchar; DestImage: pchar; DirTemp: pchar; HANDLE:THandle):integer


el mensage que envia es:

procedure WMProgress(var Message: TMessage) ; message WM_APP +1;

Si alguien la quiere que escriba a arielmendoza@hotmail.com y ejemplos.

Un saludo