Kaydet (Commit) d71bd0dd authored tarafından Eilidh McAdam's avatar Eilidh McAdam Kaydeden (comit) Fridrich Štrba

Code tidy up of indentation, comments and debug output.

Change-Id: I966d34205db1825d3aa1d328c03418817bf01bc3
Signed-off-by: 's avatarFridrich Štrba <fridrich.strba@bluewin.ch>
üst 9167f0a1
...@@ -88,6 +88,9 @@ void cabLogCCAB(PCCAB cc) ...@@ -88,6 +88,9 @@ void cabLogCCAB(PCCAB cc)
cc->iDisk, cc->setID, cc->szDisk, cc->szCab, cc->szCabPath); cc->iDisk, cc->setID, cc->szDisk, cc->szCab, cc->szCabPath);
} }
/***********************************************************************
* Define FCI callbacks
**********************************************************************/
FNFCIALLOC (fnMemAlloc) /*(ULONG cb)*/ FNFCIALLOC (fnMemAlloc) /*(ULONG cb)*/
{ {
return malloc(cb); return malloc(cb);
...@@ -214,13 +217,13 @@ FNFCIFILEPLACED (fnFilePlaced) /*(PCCAB *pccab, LPSTR pszFile, long cbFile, BOOL ...@@ -214,13 +217,13 @@ FNFCIFILEPLACED (fnFilePlaced) /*(PCCAB *pccab, LPSTR pszFile, long cbFile, BOOL
return 0; return 0;
} }
FNFCIGETNEXTCABINET(fnGetNextCab)/*(PCCAB pccab, ULONG cbPrevCab, void FAR *pv)*/ FNFCIGETNEXTCABINET(fnGetNextCab) /*(PCCAB pccab, ULONG cbPrevCab, void FAR *pv)*/
{ {
printf("DEBUG: fnGetNextCab\n"); printf("DEBUG: fnGetNextCab\n");
return TRUE; return TRUE;
} }
FNFCISTATUS(fnStatus)/*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/ FNFCISTATUS(fnStatus) /*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/
{ {
switch (typeStatus) switch (typeStatus)
{ {
...@@ -239,7 +242,7 @@ FNFCISTATUS(fnStatus)/*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/ ...@@ -239,7 +242,7 @@ FNFCISTATUS(fnStatus)/*(UINT typeStatus, ULONG cb1, ULONG cb2, void FAR *pv)*/
return 0; return 0;
} }
FNFCIGETOPENINFO(fnGetOpenInfo)/*(LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv)*/ FNFCIGETOPENINFO(fnGetOpenInfo) /*(LPSTR pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int FAR *err, void FAR *pv)*/
{ {
/* pdate: dddddmmmmyyyyyyy - d [1-31] m [1-12] y offset from 1980 */ /* pdate: dddddmmmmyyyyyyy - d [1-31] m [1-12] y offset from 1980 */
/* ptime: sssssmmmmhhhhhhh = s [second/2] m [0-59] h [0-23] */ /* ptime: sssssmmmmhhhhhhh = s [second/2] m [0-59] h [0-23] */
...@@ -267,16 +270,16 @@ FNFCIGETOPENINFO(fnGetOpenInfo)/*(LPSTR pszName, USHORT *pdate, USHORT *ptime, U ...@@ -267,16 +270,16 @@ FNFCIGETOPENINFO(fnGetOpenInfo)/*(LPSTR pszName, USHORT *pdate, USHORT *ptime, U
} }
/* /*
MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination] MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...] MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]
source - File to compress. source - File to compress.
destination - File name to give compressed file. If omitted, the destination - File name to give compressed file. If omitted, the
last character of the source file name is replaced last character of the source file name is replaced
with an underscore (_) and used as the destination. with an underscore (_) and used as the destination.
/F directives - A file with MakeCAB directives (may be repeated). /F directives - A file with MakeCAB directives (may be repeated).
/D var=value - Defines variable with specified value. /D var=value - Defines variable with specified value.
/L dir - Location to place destination (default is current directory). /L dir - Location to place destination (default is current directory).
/V[n] - Verbosity level (1..3) /V[n] - Verbosity level (1..3)
*/ */
void usage(void) void usage(void)
{ {
......
...@@ -82,21 +82,17 @@ static BOOL msidbImportStorages(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName ...@@ -82,21 +82,17 @@ static BOOL msidbImportStorages(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName
lstrcatW(storagePath, delim); lstrcatW(storagePath, delim);
lstrcatW(storagePath, storageNames[i]); lstrcatW(storagePath, storageNames[i]);
/* WINE_MESSAGE("Importing from %s\n", wine_dbgstr_w(storagePath)); */
rec = MsiCreateRecord(2); rec = MsiCreateRecord(2);
MsiRecordSetStringW(rec, 1, storageNames[i]); MsiRecordSetStringW(rec, 1, storageNames[i]);
r = MsiRecordSetStreamW(rec, 2, storagePath); r = MsiRecordSetStreamW(rec, 2, storagePath);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Error setting storage %d\n", r); */
return FALSE; return FALSE;
} }
r = MsiViewExecute(view, rec); r = MsiViewExecute(view, rec);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Unable to update with storage record %d\n", r); */
return FALSE; return FALSE;
} }
...@@ -133,10 +129,9 @@ static BOOL msidbExportStorage(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName) ...@@ -133,10 +129,9 @@ static BOOL msidbExportStorage(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName)
if ((r = MsiRecordReadStream(rec, 2, 0, &dataLen)) != ERROR_SUCCESS) if ((r = MsiRecordReadStream(rec, 2, 0, &dataLen)) != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Problem reading stream, error %d %d %d (%d)\n", r, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER, dataLen ); */
return FALSE; return FALSE;
} }
/* WINE_MESSAGE("Exporting storage %s using query %s\n", storageNameA, queryBuffer); */
if ((dataBuffer = malloc(dataLen)) == NULL) return FALSE; if ((dataBuffer = malloc(dataLen)) == NULL) return FALSE;
if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS) return FALSE; if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS) return FALSE;
...@@ -195,14 +190,12 @@ static BOOL msidbImportStreams(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR streamNames[ ...@@ -195,14 +190,12 @@ static BOOL msidbImportStreams(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR streamNames[
r = MsiRecordSetStreamW(rec, 2, streamPath); r = MsiRecordSetStreamW(rec, 2, streamPath);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Error setting stream %d (%s)\n", r, wine_dbgstr_w(streamNames[i])); */
return FALSE; return FALSE;
} }
r = MsiViewExecute(view, rec); r = MsiViewExecute(view, rec);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Unable to update with stream record %d\n", r); */
return FALSE; return FALSE;
} }
...@@ -319,7 +312,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO ...@@ -319,7 +312,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
/* WINE_MESSAGE("Error while opening db: %d %d %d %d\n", r == ERROR_BAD_PATHNAME, r == ERROR_FUNCTION_FAILED, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
return FALSE; return FALSE;
} }
...@@ -336,12 +328,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO ...@@ -336,12 +328,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
if (strcmp(fileName, ".") == 0 || strcmp(fileName, "..") == 0) continue; if (strcmp(fileName, ".") == 0 || strcmp(fileName, "..") == 0) continue;
tableFile = strdupAtoW(CP_ACP, fileName); tableFile = strdupAtoW(CP_ACP, fileName);
r = MsiDatabaseImportW(dbhandle, wdir, tableFile); r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
if (r != ERROR_SUCCESS)
{
/* WINE_MESSAGE("Failed to import %s from %s\n", wine_dbgstr_w(tableFile), wine_dbgstr_w(wdir)); */
}
free(tableFile); free(tableFile);
} }
} }
...@@ -360,11 +346,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO ...@@ -360,11 +346,6 @@ static BOOL msidbImportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[], BOO
lstrcatW(tableFile, ext); lstrcatW(tableFile, ext);
r = MsiDatabaseImportW(dbhandle, wdir, tableFile); r = MsiDatabaseImportW(dbhandle, wdir, tableFile);
if (r != ERROR_SUCCESS)
{
/* WINE_MESSAGE("Error while importing %s: %d %d %d %d\n", wine_dbgstr_w(tableFile), r == ERROR_BAD_PATHNAME, r == ERROR_FUNCTION_FAILED, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
}
free(tableFile); free(tableFile);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
...@@ -426,21 +407,11 @@ static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[]) ...@@ -426,21 +407,11 @@ static BOOL msidbExportTables(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR tables[])
lstrcatW(tableFile, ext); lstrcatW(tableFile, ext);
r = MsiDatabaseExportW(dbhandle, tableName, wdir, tableFile); r = MsiDatabaseExportW(dbhandle, tableName, wdir, tableFile);
#ifdef DEBUG
if (r != ERROR_SUCCESS)
{
/* WINE_MESSAGE("Failed to export %s. Reason: functionfailed(%d) invalidparam(%d) badpath(%d)\n",wine_dbgstr_w(tableFile), r==ERROR_FUNCTION_FAILED, r==ERROR_INVALID_PARAMETER, r==ERROR_BAD_PATHNAME ); */
}
#endif
free(tableFile); free(tableFile);
MsiCloseHandle(rec); MsiCloseHandle(rec);
} }
#ifdef DEBUG
else
{
/* WINE_MESSAGE("Failed with error. Size is now %d. Error: %d %d %d\n", size, r == ERROR_MORE_DATA, r == ERROR_INVALID_HANDLE, r == ERROR_INVALID_PARAMETER); */
}
#endif
r = MsiViewFetch(tableListView, &rec); r = MsiViewFetch(tableListView, &rec);
} }
...@@ -580,10 +551,5 @@ int wmain(int argc, WCHAR *argv[]) ...@@ -580,10 +551,5 @@ int wmain(int argc, WCHAR *argv[])
if (!msidbExportStorage(dbfile, wdir, storageName)) if (!msidbExportStorage(dbfile, wdir, storageName))
return 6; return 6;
/*for (i = 0; i < 10; i++)
{
WINE_MESSAGE("%s\t%s\t%s\t%s\t%s\n", wine_dbgstr_w(iTables[i]), wine_dbgstr_w(oTables[i]), wine_dbgstr_w(streamName), wine_dbgstr_w(streamFiles[i]), wine_dbgstr_w(storageNames[i]));
}*/
return 0; return 0;
} }
...@@ -167,26 +167,26 @@ static BOOL msiinfoUpdateProperty(MSIHANDLE infoHandle, uint property, uint data ...@@ -167,26 +167,26 @@ static BOOL msiinfoUpdateProperty(MSIHANDLE infoHandle, uint property, uint data
static void usage(void) static void usage(void)
{ {
WINE_MESSAGE( wprintf(
"Usage: msiinfo {database} [[-b]-d] {options} {data}\n" L"Usage: msiinfo {database} [[-b]-d] {options} {data}\n"
"\nOptions:\n" L"\nOptions:\n"
" -c <cp> Specify codepage\n" L" -c <cp> Specify codepage\n"
" -t <title> Specify title\n" L" -t <title> Specify title\n"
" -j <subject> Specify subject\n" L" -j <subject> Specify subject\n"
" -a <author> Specify author\n" L" -a <author> Specify author\n"
" -k <keywords> Specify keywords\n" L" -k <keywords> Specify keywords\n"
" -o <comment> Specify comments\n" L" -o <comment> Specify comments\n"
" -p <template> Specify template\n" L" -p <template> Specify template\n"
" -l <author> Specify last author\n" L" -l <author> Specify last author\n"
" -v <revno> Specify revision number\n" L" -v <revno> Specify revision number\n"
" -s <date> Specify last printed date\n" L" -s <date> Specify last printed date\n"
" -r <date> Specify creation date\n" L" -r <date> Specify creation date\n"
" -q <date> Specify date of last save\n" L" -q <date> Specify date of last save\n"
" -g <pages> Specify page count\n" L" -g <pages> Specify page count\n"
" -w <words> Specify word count\n" L" -w <words> Specify word count\n"
" -h <chars> Specify character count\n" L" -h <chars> Specify character count\n"
" -n <appname> Specify application which created the database\n" L" -n <appname> Specify application which created the database\n"
" -u <security> Specify security (0: none, 2: read only (rec.) 3: read only (enforced)\n"); L" -u <security> Specify security (0: none, 2: read only (rec.) 3: read only (enforced)\n");
} }
int wmain(int argc, WCHAR *argv[]) int wmain(int argc, WCHAR *argv[])
...@@ -196,6 +196,8 @@ int wmain(int argc, WCHAR *argv[]) ...@@ -196,6 +196,8 @@ int wmain(int argc, WCHAR *argv[])
MSIHANDLE dbhandle, infohandle; MSIHANDLE dbhandle, infohandle;
uint r; uint r;
LPWSTR value = 0; LPWSTR value = 0;
static const WCHAR h1[] = {'/', '?', 0};
static const WCHAR h2[] = {'-', '?', 0};
if (argc > 1) if (argc > 1)
{ {
...@@ -203,7 +205,12 @@ int wmain(int argc, WCHAR *argv[]) ...@@ -203,7 +205,12 @@ int wmain(int argc, WCHAR *argv[])
argv++; argc--; argv++; argc--;
} }
if (argc == 1) if (strcmpW(dbfile, h1) == 0 || strcmpW(dbfile, h2) == 0)
{
usage();
return 0;
}
else if (argc == 1)
{ {
msiinfoDisplayProperties(dbfile); msiinfoDisplayProperties(dbfile);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment