4 * Copyright 2002 Patrik Stridvall
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #define NO_SHLWAPI_REG
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(cabinet);
41 /***********************************************************************
42 * DllGetVersion (CABINET.2)
44 * Retrieves version information of the 'CABINET.DLL'
47 * pdvi [O] pointer to version information structure.
51 * Failure: E_INVALIDARG
54 * Supposedly returns version from IE6SP1RP1
56 HRESULT WINAPI CABINET_DllGetVersion (DLLVERSIONINFO *pdvi)
58 WARN("hmmm... not right version number \"5.1.1106.1\"?\n");
60 if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) return E_INVALIDARG;
62 pdvi->dwMajorVersion = 5;
63 pdvi->dwMinorVersion = 1;
64 pdvi->dwBuildNumber = 1106;
65 pdvi->dwPlatformID = 1;
70 /***********************************************************************
73 * Apparently an undocumented function, presumably to extract a CAB file
77 * unknown [IO] unknown pointer
78 * what [I] char* describing what to uncompress, I guess.
82 * Failure: E_OUTOFMEMORY (?)
84 HRESULT WINAPI Extract(DWORD unknown, LPCSTR what)
87 LPSTR dir, dirx, lastoption, x;
88 BOOL updatelastoption;
90 TRACE("(unknown == %0lx, what == %s)\n", unknown, debugstr_a(what));
92 dir = LocalAlloc(LPTR, strlen(what));
93 if (!dir) return E_OUTOFMEMORY;
95 /* copy the filename up to the last pathsep to construct the dirname */
100 if ((*whatx == '\\') || (*whatx == '/')) {
101 /* unless all chars between *dirx and lastoption are pathsep's, we
102 remember our location in dir as lastoption */
104 updatelastoption = FALSE;
105 for (x = lastoption; x < dirx; x++)
106 if ((*dirx != '\\') && (*dirx != '/')) {
107 updatelastoption = TRUE;
110 if (updatelastoption) lastoption = dirx;
118 /* FIXME: I guess use the cwd or something? */
124 TRACE("extracting to dir: %s\n", debugstr_a(dir));
126 /* FIXME: what to do on failure? */
127 if (!process_cabinet(what, dir, FALSE, FALSE))
128 return E_OUTOFMEMORY;