Jump to content

WIM, WIMGAPI, Borland C++ Builder


Recommended Posts

Hi,

I'm using Borland C++ Builder 6 to do some coding by the use of Wimgapi.dll which deals with WIM files and i did Success to capture and mount and apply some images.

i also success to get the image information but unfortunately, when i use the "WIMSetImageInformation" it didn't update the WIM internal info although i used the help which comes with WINPE 2.0.

Anyone knows a working solution for this issue?

hereunder is the code that i used which success to capture but failed to Setinfo:

//---------------------------------------------------------------------------

void __fastcall TMycallback::Aeditnewwimfile(HANDLE hImg, int imgNum, AnsiString pName, AnsiString pDesc)

{

AnsiString aall, aa, bb, cc, dd;

wchar_t *ImgInfoBuf, *NewInfoBuf;

DWORD ImgInfoBufSize;

int pre;

ImgInfoBuf = new wchar_t[20000];

WIMGetImageInformation(hImg, (LPVOID *)&ImgInfoBuf, &ImgInfoBufSize);

aall = String(WideCharToString(ImgInfoBuf));

bb = String("<IMAGE INDEX=\"" + String(imgNum) + "\">");

aa = String(aall.SubString(1, aall.Pos(bb) - 1));

pre = aa.Length() + bb.Length();

dd = String(aall.SubString(pre + 1, aall.Length() - pre));

aall = String(aa) + String(bb);

aall += String("\n <NAME>" + pName + "</NAME>");

aall += String("\n <DESCRIPTION>" + pDesc + "</DESCRIPTION>");

aall += String(dd);

NewInfoBuf = new wchar_t[20000];

aall.WideChar(NewInfoBuf,aall.WideCharBufSize());

WIMSetImageInformation(hImg, &NewInfoBuf, /*aall.Length()*/wcslen(NewInfoBuf) * sizeof(WCHAR));

}

//---------------------------------------------------------------------------

void __fastcall TMycallback::Acapture(AnsiString afile, AnsiString adir, AnsiString adesc, BOOL compre, BOOL booot)

{

AnsiString aa, bb;

aa = String(afile);

bb = String(adir);

wimFile = new wchar_t[10000];

wimDir = new wchar_t[10000];

aa.WideChar(wimFile,aa.WideCharBufSize());

bb.WideChar(wimDir,aa.WideCharBufSize());

Mycallback->Caption = String("Capturing....");

WIMRegisterMessageCallback(NULL, (FARPROC)CaptureCallback, NULL);

handle1 = WIMCreateFile(wimFile, GENERIC_WRITE, CREATE_ALWAYS, 0x00000040, compre, NULL);

handle2 = WIMCaptureImage(handle1, wimDir, 0x00000002);

Aeditnewwimfile(handle2, 1, adesc, adesc);

if (booot == true) {}

WIMCloseHandle(handle2);

WIMCloseHandle(handle1);

Close();

}

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...