Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Use Windows wimgapi dll

by iea (Beadle)
on Aug 04, 2008 at 07:48 UTC ( [id://701991]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^4: Use Windows wimgapi dll
by ikegami (Patriarch) on Aug 04, 2008 at 08:03 UTC

    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"
        You haven't added
        use strict; use warnings;
        Here is my code ...
        use Win32::API; use Data::Dumper; use Encode qw( encode ); #API FUNCTION WIMCreateFile # HANDLE # WINAPI # WIMCreateFile( # LPWSTR lpszWimPath, # DWORD dwDesiredAccess, # DWORD dwCreationDisposition, # DWORD dwFlagsAndAttributes, # DWORD dwCompressionType, # LPDWORD lpdwCreationResult # ); my $filehandler = encode('UCS-2le', "C:\\test.wim"); #Code example in C #TCHAR *wimFile = TEXT("C:\\sample_image.wim"); my $wimfile = new Win32::API("wimgapi", "WIMCreateFile", ['P','N','N', +'N','N','N'], 'N'); my $hWim = $wimfile->Call($filehandler, WIM_GENERIC_WRITE, WIM_CREATE_NEW, 0, 0, 0); #Code example in C # hWim = WIMCreateFile ( wimFile, //exis +ting .wim file to append to # WIM_GENERIC_READ | WIM_GENERIC_WRITE, //acce +ss mode # WIM_OPEN_EXISTING, //open + flag # 0, // or +WIM_FLAG_VERIFY flag for file corruption check # 0, # &created ); print $hWim;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://701991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-29 14:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found