News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

wimgapi

Started by bomz, December 25, 2014, 07:10:02 PM

Previous topic - Next topic

bomz

Hi for all!
Please help me do wimgapi.inc and lib for masm32.

hutch--

Best I can do you in a hurry, its from the wimgapi.h file from my win7 64.


WIM_GENERIC_READ                 equ GENERIC_READ
WIM_GENERIC_WRITE                equ GENERIC_WRITE
WIM_GENERIC_MOUNT                equ GENERIC_EXECUTE
WIM_CREATE_NEW                   equ CREATE_NEW
WIM_CREATE_ALWAYS                equ CREATE_ALWAYS
WIM_OPEN_EXISTING                equ OPEN_EXISTING
WIM_OPEN_ALWAYS                  equ OPEN_ALWAYS
WIM_FLAG_RESERVED                equ 00000001h
WIM_FLAG_VERIFY                  equ 00000002h
WIM_FLAG_INDEX                   equ 00000004h
WIM_FLAG_NO_APPLY                equ 00000008h
WIM_FLAG_NO_DIRACL               equ 00000010h
WIM_FLAG_NO_FILEACL              equ 00000020h
WIM_FLAG_SHARE_WRITE             equ 00000040h
WIM_FLAG_FILEINFO                equ 00000080h
WIM_FLAG_NO_RP_FIX               equ 00000100h
WIM_FLAG_MOUNT_READONLY          equ 00000200h
WIM_MOUNT_FLAG_MOUNTED           equ 00000001h
WIM_MOUNT_FLAG_MOUNTING          equ 00000002h
WIM_MOUNT_FLAG_REMOUNTABLE       equ 00000004h
WIM_MOUNT_FLAG_INVALID           equ 00000008h
WIM_MOUNT_FLAG_NO_WIM            equ 00000010h
WIM_MOUNT_FLAG_NO_MOUNTDIR       equ 00000020h
WIM_MOUNT_FLAG_MOUNTDIR_REPLACED equ 00000040h
WIM_MOUNT_FLAG_READWRITE         equ 00000100h
WIM_COMMIT_FLAG_APPEND           equ 00000001h
WIM_REFERENCE_APPEND             equ 00010000h
WIM_REFERENCE_REPLACE            equ 00020000h
WIM_EXPORT_ALLOW_DUPLICATES      equ 00000001h
WIM_EXPORT_ONLY_RESOURCES        equ 00000002h
WIM_EXPORT_ONLY_METADATA         equ 00000004h
INVALID_CALLBACK_VALUE           equ 0FFFFFFFFh
WIM_COPY_FILE_RETRY              equ 01000000h
WIM_DELETE_MOUNTS_ALL            equ 00000001h
WIM_MSG_SUCCESS                  equ ERROR_SUCCESS
WIM_MSG_DONE                     equ 0FFFFFFF0h
WIM_MSG_SKIP_ERROR               equ 0FFFFFFFEh
WIM_MSG_ABORT_IMAGE              equ 0FFFFFFFFh
WIM_ATTRIBUTE_NORMAL             equ 00000000h
WIM_ATTRIBUTE_RESOURCE_ONLY      equ 00000001h
WIM_ATTRIBUTE_METADATA_ONLY      equ 00000002h
WIM_ATTRIBUTE_VERIFY_DATA        equ 00000004h
WIM_ATTRIBUTE_RP_FIX             equ 00000008h
WIM_ATTRIBUTE_SPANNED            equ 00000010h
WIM_ATTRIBUTE_READONLY           equ 00000020h

WIM_INFO STRUCT
   WimPath[MAX_PATH]      WORD ?
   Guid                   GUID <>
   ImageCount             DWORD ?
   CompressionType        DWORD ?
   PartNumber             WORD ?
   TotalParts             WORD ?
   BootIndex              DWORD ?
   WimAttributes          DWORD ?
   WimFlagsAndAttr        DWORD ?
WIM_INFO ENDS

WIM_MOUNT_LIST STRUCT
   WimPath[MAX_PATH]      WORD ?
   MountPath[MAX_PATH]    WORD ?
   ImageIndex             DWORD ?
   MountedForRW           DWORD ?
   P LPWIM_MOUNT_INFO_LEVEL0 WIM_MOUNT_INFO_LEVEL0, <>
WIM_MOUNT_LIST ENDS

WIM_MOUNT_INFO_LEVEL1 STRUCT
   WimPath[MAX_PATH]      WORD ?
   MountPath[MAX_PATH]    WORD ?
   ImageIndex             DWORD ?
   MountFlags             DWORD ?
WIM_MOUNT_INFO_LEVEL1 ENDS

SFileIOCallbackInfo STRUCT
   pfnOpenFile            FileIOCallbackOpenFile <>
   pfnCloseFile           FileIOCallbackCloseFile <>
   pfnReadFile            FileIOCallbackReadFile <>
   pfnSetFilePointer      FileIOCallbackSetFilePointer <>
   pfnGetFileSize         FileIOCallbackGetFileSize <>
SFileIOCallbackInfo ENDS


Here are the function prototypes from the library.


; --------------------------------------------------------------------------------------------------
;                           wimgapi.inc Copyright The MASM32 SDK 1998-2010
; --------------------------------------------------------------------------------------------------

IFNDEF WIMGAPI_INC
WIMGAPI_INC equ <1>

DllMain PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMApplyImage PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMCaptureImage PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMCloseHandle PROTO STDCALL :DWORD
WIMCommitImageHandle PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMCopyFile PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WIMCreateFile PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WIMDeleteImage PROTO STDCALL :DWORD,:DWORD
WIMDeleteImageMounts PROTO STDCALL :DWORD
WIMExportImage PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMExtractImagePath PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WIMGetAttributes PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMGetImageCount PROTO STDCALL :DWORD
WIMGetImageInformation PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMGetMessageCallbackCount PROTO STDCALL :DWORD
WIMGetMountedImageHandle PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WIMGetMountedImageInfo PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WIMGetMountedImageInfoFromHandle PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WIMGetMountedImages PROTO STDCALL :DWORD,:DWORD
WIMInitFileIOCallbacks PROTO STDCALL :DWORD
WIMLoadImage PROTO STDCALL :DWORD,:DWORD
WIMMountImage PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WIMMountImageHandle PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMRegisterLogFile PROTO STDCALL :DWORD,:DWORD
WIMRegisterMessageCallback PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMRemountImage PROTO STDCALL :DWORD,:DWORD
WIMSetBootImage PROTO STDCALL :DWORD,:DWORD
WIMSetFileIOCallbackTemporaryPath PROTO STDCALL :DWORD
WIMSetImageInformation PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMSetReferenceFile PROTO STDCALL :DWORD,:DWORD,:DWORD
WIMSetTemporaryPath PROTO STDCALL :DWORD,:DWORD
WIMSplitFile PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WIMUnmountImage PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WIMUnmountImageHandle PROTO STDCALL :DWORD,:DWORD
WIMUnregisterLogFile PROTO STDCALL :DWORD
WIMUnregisterMessageCallback PROTO STDCALL :DWORD,:DWORD

ELSE
  echo ------------------------------------------
  echo WARNING duplicate include file wimgapi.inc
  echo ------------------------------------------
ENDIF

bomz

Thanks.

I also do something. The main - lib from studio works or not. To be or not to be

bomz

#3
.386

.model flat, stdcall
option casemap :none


include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\gdi32.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\wimgapi.inc

includelib \MASM32\LIB\wimgapi.lib


.data
mestitle db "Bomz",0
form db "EAX: %u", 0
WimFile dw "m","y","w","i","m",".","w","i","m", 0 ;
dw 18 ;
dw 20 ;
dd offset WimFile ;


.data?
buffer db 512 dup(?)
wimHandle dd ?

.code
start:
invoke WIMCreateFile,addr WimFile,WIM_GENERIC_WRITE,WIM_CREATE_NEW,WIM_FLAG_SHARE_WRITE,WIM_COMPRESS_NONE,WIM_CREATED_NEW
mov wimHandle, eax
invoke GetLastError
invoke wsprintf,ADDR buffer,ADDR form,eax
invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
;invoke WIMCloseHandle,wimHandle
invoke ExitProcess,0
end start


WIM_COMPRESS_NONE         equ   0
WIM_COMPRESS_XPRESS         equ   1
WIM_COMPRESS_LZX         equ   2
;  WM_APP = 8000h
WIM_MSG               = WM_APP  + 1476;
WIM_MSG_TEXT            = WIM_MSG + 1;
WIM_MSG_PROGRESS         = WIM_MSG + 2;
WIM_MSG_PROCESS            = WIM_MSG + 3;
WIM_MSG_SCANNING         = WIM_MSG + 4;
WIM_MSG_SETRANGE         = WIM_MSG + 5;
WIM_MSG_SETPOS            = WIM_MSG + 6;
WIM_MSG_STEPIT            = WIM_MSG + 7;
WIM_MSG_COMPRESS         = WIM_MSG + 8;
WIM_MSG_ERROR            = WIM_MSG + 9;
WIM_MSG_ALIGNMENT         = WIM_MSG + 10;
WIM_MSG_RETRY            = WIM_MSG + 11;
WIM_MSG_SPLIT            = WIM_MSG + 12;
WIM_MSG_FILEINFO         = WIM_MSG + 13;
WIM_MSG_INFO            = WIM_MSG + 14;
WIM_MSG_WARNING            = WIM_MSG + 15;
WIM_MSG_CHK_PROCESS         = WIM_MSG + 16;
WIM_MSG_WARNING_OBJECTID      = WIM_MSG + 17;
WIM_MSG_STALE_MOUNT_DIR         = WIM_MSG + 18;
WIM_MSG_STALE_MOUNT_FILE      = WIM_MSG + 19;
WIM_MSG_MOUNT_CLEANUP_PROGRESS      = WIM_MSG + 20;
WIM_MSG_CLEANUP_SCANNING_DRIVE      = WIM_MSG + 21;
WIM_MSG_IMAGE_ALREADY_MOUNTED      = WIM_MSG + 22;
WIM_MSG_CLEANUP_UNMOUNTING_IMAGE   = WIM_MSG + 23;
WIM_MSG_QUERY_ABORT         = WIM_MSG + 24;


bomz


Vortex

Hi bomz,

Here is an open-source version :

Quote
Description

wimlib is a C library for creating, modifying, extracting, and mounting Windows Imaging (WIM) files. wimlib and its command-line frontend 'wimlib-imagex' provide a free and cross-platform alternative to Microsoft's WIMGAPI, ImageX, and DISM.

wimlib can be used to back up, install, or restore Windows operating systems; to create customized images of Windows PE; or to archive files on either Windows or UNIX/Linux.

wimlib contains advanced implementations of the XPRESS and LZX compression algorithms which typically outperform and outcompress the Microsoft equivalents.

wimlib supports advanced filesystem features such as hard links, symbolic links, junctions, named data streams, device nodes, and FIFOs. NTFS-specific features are supported either natively (Windows) or via NTFS-3g (UNIX/Linux).

wimlib is distributed either as a source tarball (for UNIX/Linux), or as ready-to-use binaries (for Windows XP and later).

http://sourceforge.net/projects/wimlib/

bomz