in reply to Re: Use Windows wimgapi dll
in thread Use Windows wimgapi dll

Hi, thanks for your fast replies and sry for my delay.
>>Where does WIM_GENERIC_WRITE.. come from?
They are defined in the wimgapi doc, you can find them with waik.

@ikegami I did try a simple open ... I added your encode line but it still doesnt work.
use Encode qw( encode ); my $filehandler = encode('UCS-2le', 'C:\\data.wim'); my $wimfile = new Win32::API("wimgapi", "WIMCreateFile", ['S','C','C', +'C','C','C'], 'N'); my $value = $wimfile->Call($filehandler,WIM_GENERIC_WRITE,WIM_OPEN_EXI +STING,WIM_FLAG_VERIFY,WIM_COMPRESS_NONE,WIM_OPENED_EXISTING);
i get following errorcode...
semi-panic: attempt to dup freed string at test.pl line 10, <DATA> lin +e 164. Can't call method "Pack" on an undefined value at test.pl line 10, <DA +TA> line 164.
anybody knows what i´m doing wrong?
thanks for your help

Replies are listed 'Best First'.
Re^3: Use Windows wimgapi dll
by iea (Beadle) on Aug 04, 2008 at 07:48 UTC
    thanks for your answer ... I added "\0" to the string but there is no change. I dont get any error message it just returns 0 as filehandle. my $hWim = $wimfile->Call(... #returns 0 see code above

      One thing I forgot is that you need to add "\0" your string pre-encoding (or "\0" to your post-encoding). Win32::API will add the byte \0 for you, but the char \0 is expected (which is encoded as two \0 bytes).

      So what's the error message? I bet it can be fetched via GetLastError (and a quick look at the docs would confirm that).

        thanks for your answer ...
        I added "\0" to the string but there is no change.
        I dont get any error message it just returns 0 as filehandle.
        my $hWim = $wimfile->Call(... #returns 0 see code above
        "sry for double post"