home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2001 January
/
VPR0101A.BIN
/
OLS
/
TAR32053
/
tar32053.exe
/
SRC
/
TARMSG.C
< prev
next >
Wrap
C/C++ Source or Header
|
1999-05-23
|
5KB
|
158 lines
/*
TarMsg.c
この中の関数を呼ぶと、SetOwnerWindowで設定されたWindowにメッセージを通知することができる。
*/
#include "tarmsg.h"
#include "tar32.h"
#include "dfltwin.h"
#include "main.h"
#include <windows.h>
/*nMode wParam の値です。UNLHA32.DLL の処理の状態を表します。
0 : UNLHA32.DLL が該当ファイルの処理を開始することを表します。
1 : UNLHA32.DLL が該当ファイルの展開中であることを表します。
2 : UNLHA32.DLL が処理を終え,lpEis のメモリを開放しようとしてい
ることを表します。
3 : UNLHA32.DLL が該当書庫の処理を開始することを表します。szSour-
ceFileName に書庫名が格納されます。
4 : UNLHA32.DLL がワークファイルの書き戻しを開始することを表しま
す。szSourceFileName にワークファイル名が格納されます。
*/
HWND OwnerWindow=NULL;
ARCHIVERPROC *ArchiverProc=NULL;
UINT WM_ARCEXTRACT_UINT=0;
static HWND OwnerWindowItr=NULL; /* 解凍状況を通知するウィンドウ */
static ARCHIVERPROC *ArchiverProcItr=NULL; /* 解凍状況を通知する関数 */
static EXTRACTINGINFOEX info; /* ウインドウにポインタを渡す解凍状況 */
extern HWND api_hwnd;
/*****local functions*********/
static int TarMsg(int mode,EXTRACTINGINFOEX *pInfo)
{
int ret1=0,ret2=1;
if(OPTION_display_dialog==0){return 0;}
//MessageBox(api_hwnd,"preSendMEssage","tar32.dll",0);
ret1=SendMessage(OwnerWindowItr,WM_ARCEXTRACT_UINT,(WPARAM)mode,(LPARAM)pInfo);
//MessageBox(api_hwnd,"postSendMEssage","tar32.dll",0);
/*
if(ret1 != 0){
char str[1000];
sprintf(str,"SendMessage return=%d",ret1);
MessageBox(api_hwnd,str,"TAR32.DLL",0);
}*/
if(ArchiverProcItr!=NULL){
ret2=(*ArchiverProcItr)(OwnerWindow,WM_ARCEXTRACT_UINT,mode,pInfo);
}
return (ret1==0 && ret2 !=0 ? 0 : -1 );
}
static void ExtractingInfoExInit(EXTRACTINGINFOEX *info)
{
memset(info,0,sizeof(EXTRACTINGINFOEX));
}
static void HeaderToExtractingInfoEx(EXTRACTINGINFOEX *exinfo,HEADER *phead,char *srcfile,char *destfile,int writesize)
{
INDIVIDUALINFO iinfo;
extern void HeaderToIndividualInfo(INDIVIDUALINFO *info,HEADER *head,char *fname);
HeaderToIndividualInfo(&iinfo,phead,srcfile);
exinfo->exinfo.dwFileSize=iinfo.dwOriginalSize;
exinfo->exinfo.dwWriteSize=writesize;
strcpy(exinfo->exinfo.szSourceFileName,srcfile);
strcpy(exinfo->exinfo.szDestFileName,destfile);
exinfo->dwCompressedSize=iinfo.dwCompressedSize;
exinfo->dwCRC=iinfo.dwCRC;
exinfo->uOSType=iinfo.uOSType;
exinfo->wRatio=iinfo.wRatio;
exinfo->wDate=iinfo.wDate;
exinfo->wTime=iinfo.wTime;
strncpy(exinfo->szAttribute,iinfo.szAttribute,8);
strncpy(exinfo->szMode,iinfo.szMode,8);
}
/*****global functions*************/
/* メッセージ通知処理の初期化 */
void TarMsg_static_init(void)
{
OwnerWindowItr=NULL;
ArchiverProcItr=NULL;
if(WM_ARCEXTRACT_UINT==0){
WM_ARCEXTRACT_UINT=RegisterWindowMessage(WM_ARCEXTRACT);
}
}
/* 書庫ファイル(xxx.tgzなど)の処理開始 */
int TarMsgArcFileBegin(char *arcfile)
{
if(OPTION_display_dialog==0){return 0;}
if(OwnerWindow || ArchiverProc){
OwnerWindowItr=OwnerWindow;
ArchiverProcItr=ArchiverProc;
}else{
//MessageBox(api_hwnd,"preownerwindowitr","tar32.dll debug",0);
DefaultWindowInit(&OwnerWindowItr,&ArchiverProcItr);
//MessageBox(api_hwnd,"post ownerwindowitr","tar32.dll debug",0);
}
ExtractingInfoExInit(&info);
strcpy(info.exinfo.szSourceFileName,arcfile);
return TarMsg(ARCEXTRACT_OPEN,&info);
}
/* 書庫ファイル内に格納されたファイルの処理開始 */
int TarMsgFileBegin(HEADER *head,char *szDestFileName,char *szSourceFileName)
{
if(OPTION_display_dialog==0){return 0;}
if(OwnerWindowItr == NULL){return 0;}
HeaderToExtractingInfoEx(&info,head,szDestFileName,szSourceFileName,0);
return TarMsg(ARCEXTRACT_BEGIN,&info);
}
/* 書庫ファイル内に格納されたファイルの処理中 */
int TarMsgFileInProcess(HEADER *head,char *szDestFileName,char *szSourceFileName,int done_size)
{
if(OPTION_display_dialog==0){return 0;}
if(OwnerWindowItr == NULL){return 0;}
HeaderToExtractingInfoEx(&info,head,szDestFileName,szSourceFileName,done_size);
return TarMsg(ARCEXTRACT_INPROCESS,&info);
}
/* すべての処理を終了 */
void TarMsgEnd(void)
{
if(OPTION_display_dialog==0){return;}
if(OwnerWindowItr == NULL){return;}
ExtractingInfoExInit(&info);
//MessageBox(api_hwnd,"TarMsgEnd1","tar32.dll debug",0);
TarMsg(ARCEXTRACT_END,&info);
//MessageBox(api_hwnd,"TarMsgEnd2","tar32.dll debug",0);
if(OwnerWindow == NULL){
WaitDefaultWindowEnd();
}
//MessageBox(api_hwnd,"TarMsgEnd3","tar32.dll debug",0);
ArchiverProcItr=NULL;
OwnerWindowItr=NULL;
}