Download Pelles C here: http://www.pellesc.se
#include <stdlib.h>
//#include <zip.h>
#pragma comment(lib, "zip.lib")
//#include "zip_stdcall.h"
#define ZIP_DEFAULT_COMPRESSION_LEVEL 6
typedef struct zip_t zip_t;
extern struct zip_t __stdcall *zip_open(const char *zipname, int level, char mode);
extern int __stdcall zip_entry_open(struct zip_t *zip, const char *entryname);
extern int __stdcall zip_entry_fwrite(struct zip_t *zip, const char *filename);
extern int __stdcall zip_entry_close(struct zip_t *zip);
extern int __stdcall zip_close(struct zip_t *zip);
int __cdecl main(void)
{
struct zip_t *zip = zip_open("test.zip", ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
{
zip_entry_open(zip, "sample.docx");
{
zip_entry_fwrite(zip, "sample.docx");
}
zip_entry_close(zip);
}
zip_close(zip);
return 0;
}
#include <stdlib.h>
//#include <zip.h>
#pragma comment(lib, "zip.lib")
//#include "zip_stdcall.h"
#define ZIP_DEFAULT_COMPRESSION_LEVEL 6
typedef struct zip_t zip_t;
extern struct zip_t __stdcall *zip_open(const char *zipname, int level, char mode);
extern int __stdcall zip_entry_open(struct zip_t *zip, const char *entryname);
extern int __stdcall zip_entry_fwrite(struct zip_t *zip, const char *filename);
extern int __stdcall zip_entry_close(struct zip_t *zip);
extern int __stdcall zip_close(struct zip_t *zip);
int __cdecl main(void)
{
struct zip_t *zip = zip_open("meta.zip", ZIP_DEFAULT_COMPRESSION_LEVEL, 'w');
{
zip_entry_open(zip, "meta.xml");
{
zip_entry_fwrite(zip, "meta.xml");
}
zip_entry_close(zip);
}
zip_close(zip);
return 0;
}
.386
.model flat,stdcall
option casemap:none
include MsgOnlyWnd.inc
.data
ClassName db 'MessageOnlyWindow',0
file db 'test12345.txt',0
.data?
hInstance dd ?
wc WNDCLASSEX <?>
msg MSG <?>
.code
start:
invoke GetModuleHandle,0
mov hInstance,eax
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.lpfnWndProc,OFFSET WndProc
mov wc.hInstance,eax
mov wc.lpszClassName,OFFSET ClassName
invoke RegisterClassEx,ADDR wc
xor eax,eax
invoke CreateWindowEx,NULL,ADDR ClassName,eax,\
eax,eax,eax,eax,eax,\
HWND_MESSAGE,eax,hInstance,eax
.WHILE TRUE
invoke GetMessage,ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
.ENDW
invoke ExitProcess,0
WndProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
.IF uMsg==WM_CREATE
invoke SetTimer,hWnd,ID_TIMER,3000,ADDR TimerProc
.ELSEIF uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.ELSE
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
WndProc ENDP
TimerProc PROC hWnd:DWORD,uMsg:DWORD,idEvent:DWORD,dwTime:DWORD
invoke exist,ADDR file
test eax,eax
jz @f
invoke DeleteFile,ADDR file
@@:
invoke KillTimer,hWnd,ID_TIMER
xor eax,eax
invoke SendMessage,hWnd,WM_DESTROY,eax,eax
ret
TimerProc ENDP
exist PROC lpszFileName:DWORD ; function from masm32.lib
LOCAL wfd:WIN32_FIND_DATA
invoke FindFirstFile,lpszFileName,ADDR wfd
.if eax == INVALID_HANDLE_VALUE
xor eax,eax ; 0 = NOT exist
.else
invoke FindClose,eax
mov eax,1 ; 1 = exist
.endif
ret
exist ENDP
END start
Page created in 0.048 seconds with 15 queries.