⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sfxwiz.c

📁 压缩解压,是unzip540的升级,这个外国网站摘来的源码,是evb编写.
💻 C
📖 第 1 页 / 共 2 页
字号:
                ofn.lpstrFilter = NULL;                ofn.nFilterIndex = 1;                ofn.lpstrFile = szTemp;                ofn.nMaxFile = MAX_PATH;                ofn.lpstrFileTitle = NULL;                ofn.nMaxFileTitle = MAX_PATH; /* ignored ! */                ofn.lpstrTitle = (LPSTR)"Set Extraction Directory";                ofn.lpstrInitialDir = NULL;                ofn.Flags = OFN_ENABLEHOOK |#ifdef WIN32                            OFN_EXPLORER|#endif                            OFN_HIDEREADONLY|OFN_NOVALIDATE;#ifndef WIN32                lpGetDirProc = MakeProcInstance((FARPROC)GetDirProc, hInst);   #ifndef MSC                (UINT CALLBACK *)ofn.lpfnHook = (UINT CALLBACK *)lpGetDirProc;   #else                ofn.lpfnHook = lpGetDirProc;   #endif#else                ofn.lpfnHook = (LPOFNHOOKPROC)GetDirProc;#endif                ofn.lpTemplateName = "GETDIR";   /* see getfiles.dlg   */                if (!GetOpenFileName(&ofn))                   {                   break;                   }                ofn.lpstrFile[ofn.nFileOffset-1] = '\0';#ifdef WIN32                SetCurrentDirectory(ofn.lpstrFile);#else                getcwd(szTemp, MAX_PATH);                chdir(ofn.lpstrFile);                setdisk(toupper(ofn.lpstrFile[0]) - 'A');#endif                lstrcpy(szTarget,ofn.lpstrFile);                SetDlgItemText(hDlg,ID_TARGET,(LPSTR)szTarget);                }               break;            case IDOK:#ifdef WIN32               GetCurrentDirectory(_MAX_PATH,szTarget);#else               getcwd(szTarget, _MAX_PATH);#endif               lpDCL->ncflag = 0;               lpDCL->fQuiet = 0; // If not zero, no status messages will come through               lpDCL->ntflag = 0;               lpDCL->nvflag = 0;               lpDCL->nzflag = 0;               lpDCL->ndflag = 1;               lpDCL->naflag = 0;               lpDCL->nfflag = 0;               lpDCL->noflag = 0;               lpDCL->PromptToOverwrite = 1;               lpDCL->ExtractOnlyNewer = 0;               lpDCL->lpszZipFN = zfn;               lpDCL->lpszExtractDir = NULL;               iReturn = Wiz_SingleEntryUnzip(0, NULL, 0, NULL, lpDCL, lpUserFunctions);/* external return codes for unzip library *///#define PK_OK              0   /* no error *///#define PK_COOL            0   /* no error *///#define PK_WARN            1   /* warning error *///#define PK_ERR             2   /* error in zipfile *///#define PK_BADERR          3   /* severe error in zipfile *///#define PK_MEM             4   /* insufficient memory (during initialization) *///#define PK_MEM2            5   /* insufficient memory (password failure) *///#define PK_MEM3            6   /* insufficient memory (file decompression) *///#define PK_MEM4            7   /* insufficient memory (memory decompression) *///#define PK_MEM5            8   /* insufficient memory (not yet used) *///#define PK_NOZIP           9   /* zipfile not found *///#define PK_PARAM          10   /* bad or illegal parameters specified *///#define PK_FIND           11   /* no files found *///#define PK_DISK           50   /* disk full *///#define PK_EOF            51   /* unexpected EOF *///#define IZ_CTRLC          80   /* user hit ^C to terminate *///#define IZ_UNSUP          81   /* no files found: all unsup. compr/encrypt. *///#define IZ_BADPWD         82   /* no files found: all had bad password *//* return codes of password fetches (negative = user abort; positive = error) *///#define IZ_PW_ENTERED      0   /* got some password string; use/try it *///#define IZ_PW_CANCEL      -1   /* no password available (for this entry) *///#define IZ_PW_CANCELALL   -2   /* no password, skip any further pwd. request *///#define IZ_PW_ERROR        5   /* = PK_MEM2 : failure (no mem, no tty, ...) */               switch (iReturn) {                case PK_OK:                     wsprintf(szMessage, "%s", "All files extracted OK");                     break;                case PK_ERR:                     wsprintf(szMessage, "%s", "Warning occurred on one or more files");                     break;                case PK_BADERR:                     wsprintf(szMessage, "%s", "Error in archive");                     break;                case PK_MEM:                case PK_MEM2:                case PK_MEM3:                case PK_MEM4:                case PK_MEM5:                     wsprintf(szMessage, "%s", "Insufficient memory");                     break;                case PK_NOZIP:                     wsprintf(szMessage, "%s", "Archive not found");                     break;                case PK_FIND:                     wsprintf(szMessage, "%s", "No files found");                     break;                case PK_DISK:                     wsprintf(szMessage, "%s", "Disk full");                     break;                case PK_EOF:                     wsprintf(szMessage, "%s", "Unexpected end of file");                     break;                case IZ_UNSUP:                     wsprintf(szMessage, "%s", "No files found: All unsupported");                     break;                case IZ_BADPWD:                     wsprintf(szMessage, "%s", "No files found: Bad password");                     break;                default:                     wsprintf(szMessage, "%s", "Unknown error");                     break;                }               MessageBox(hDlg, szMessage, szAppName, MB_OK);/* Uncomment line below to have SFXWix terminate automatically   when done. *///              EndDialog(hDlg, wParam);               break;               case IDCANCEL:                    EndDialog(hDlg, wParam);                    PostQuitMessage(0);                    exit(0); // ..and then quit                    break;         }         break;      default:         fProcessed = FALSE;         break;   }   return(fProcessed);}#define WasCancelled(hDlg) (!IsWindowEnabled(GetDlgItem(hDlg,IDCANCEL)))#ifdef __BORLANDC__#pragma argsused#endifint WINAPI password(LPSTR p, int n, LPCSTR m, LPCSTR name){TCHAR sz[MAX_PATH];sprintf(sz, "%s is encrypted", name);MessageBox(hWnd, sz, "Encryption not supported", MB_OK);return IZ_PW_CANCELALL;}int WINAPI DisplayBuf(TCHAR far *buf, unsigned long size){if ((buf[0] != '\n') && (buf[0] != '\r'))   SetDlgItemText(hWnd, ID_STATUS, buf);return (unsigned int) size;}int WINAPI GetReplaceDlgRetVal(TCHAR *filename){#ifndef WIN32FARPROC lpfnprocReplace;#endifint ReplaceDlgRetVal;   /* replace dialog return value */#ifdef WIN32ReplaceDlgRetVal = DialogBoxParam(hInst, "Replace",   hWnd, (DLGPROC)ReplaceProc, (DWORD)(LPSTR)filename);#elselpfnprocReplace = MakeProcInstance(ReplaceProc, hInst);ReplaceDlgRetVal = DialogBoxParam(hInst, "Replace",   hWnd, lpfnprocReplace, (DWORD)(LPSTR)filename);FreeProcInstance(lpfnprocReplace);#endifreturn ReplaceDlgRetVal;}#ifdef __BORLANDC__#pragma argsused#endifvoid WINAPI ReceiveDllMessage(unsigned long ucsize, unsigned long csiz,   unsigned cfactor, unsigned mo, unsigned dy, unsigned yr, unsigned hh,   unsigned mm, TCHAR c, LPSTR filename, LPSTR methbuf, unsigned long crc,   TCHAR fCrypt){}#ifdef __BORLANDC__#pragma argsused#endifint PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,                    LPSTR lpszCmdLine, int nCmdShow){TCHAR *ptr = NULL;hInst = hInstance;hDCL = GlobalAlloc( GPTR, (DWORD)sizeof(DCL));if (!hDCL)   {   return 0;   }lpDCL = (LPDCL)GlobalLock(hDCL);if (!lpDCL)   {   return 0;   }hUF = GlobalAlloc( GPTR, (DWORD)sizeof(USERFUNCTIONS));if (!hUF)   {   return 0;   }lpUserFunctions = (LPUSERFUNCTIONS)GlobalLock(hUF);if (!lpUserFunctions)   {   return 0;   }lpUserFunctions->password = password;lpUserFunctions->print = DisplayBuf;lpUserFunctions->sound = NULL;lpUserFunctions->replace = GetReplaceDlgRetVal;lpUserFunctions->SendApplicationMessage = ReceiveDllMessage;lpUserFunctions->ServCallBk = NULL;GetModuleFileName(hInstance,(LPSTR)szThisApp,sizeof(szThisApp));lstrcpy(zfn, szThisApp);ptr = strrchr(szThisApp, '\\');if (ptr != NULL)   {   lstrcpy(szAppName, ptr);   ptr[0] = '\0';   lstrcpy(szTarget, szThisApp);   iReturn = DialogBox(hInstance, MAKEINTRESOURCE(INITDIALOG),         (HWND)NULL, (DLGPROC)InitDialogProc);   DestroyWindow((HWND) INITDIALOG);#ifdef WIN32   SetCurrentDirectory(szHomeDir);#else   getcwd(szTarget, MAX_PATH);   chdir(szHomeDir);   setdisk(toupper(szHomeDir[0]) - 'A');#endif   }PostQuitMessage(0);return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -