Fixed ANSI C related compile problems.

This commit is contained in:
Patrik Stridvall 2000-03-24 20:40:41 +00:00 committed by Alexandre Julliard
parent 4bb532e72d
commit 205721e724
10 changed files with 276 additions and 214 deletions

View file

@ -217,7 +217,7 @@ HRESULT (WINAPI *fnAVIStreamGetFrameClose)(PGETFRAME pg);
int i,palchanged; int i,palchanged;
/* skip used colorentries. */ /* skip used colorentries. */
decodedbits+=bmi->biClrUsed*sizeof(RGBQUAD); decodedbits=(char*)decodedbits+bmi->biClrUsed*sizeof(RGBQUAD);
palchanged = 0; palchanged = 0;
for (i=0;i<bmi->biClrUsed;i++) { for (i=0;i<bmi->biClrUsed;i++) {
if ( (palent[i].peRed != rgb[i].rgbRed) || if ( (palent[i].peRed != rgb[i].rgbRed) ||
@ -245,8 +245,8 @@ HRESULT (WINAPI *fnAVIStreamGetFrameClose)(PGETFRAME pg);
} }
/* Argh. AVIs are upside down. */ /* Argh. AVIs are upside down. */
for (i=0;i<dsdesc.dwHeight;i++) { for (i=0;i<dsdesc.dwHeight;i++) {
memcpy( dsdesc.u1.lpSurface+(i*dsdesc.lPitch), memcpy( (char *)dsdesc.u1.lpSurface+(i*dsdesc.lPitch),
decodedbits+bytesline*(dsdesc.dwHeight-i-1), (char *)decodedbits+bytesline*(dsdesc.dwHeight-i-1),
bytesline bytesline
); );
} }

View file

@ -1,16 +1,21 @@
// (c) 1999-2000 Eric Williams. Rights as specified under the WINE /*
// License. Don't hoard code; share it! * (c) 1999-2000 Eric Williams. Rights as specified under the WINE
* License. Don't hoard code; share it!
*/
// /*
// One might call this a Commdlg test jig. Its sole function in life * One might call this a Commdlg test jig. Its sole function in life
// is to call the Commdlg Common Dialogs. The results of a call to * is to call the Commdlg Common Dialogs. The results of a call to
// File Open or File Save are printed in the upper left corner; * File Open or File Save are printed in the upper left corner;
// Font adjusts the font of the printout, and Color adjusts the color * Font adjusts the font of the printout, and Color adjusts the color
// of the background. * of the background.
*/
// Ideally it would also do event logging and be a bit less stupid /*
// about displaying the results of the various requesters. But hey, * Ideally it would also do event logging and be a bit less stupid
// it's only a first step. :-) * about displaying the results of the various requesters. But hey,
* it's only a first step. :-)
*/
#include <windows.h> #include <windows.h>
#include <commdlg.h> #include <commdlg.h>
@ -18,37 +23,47 @@
#include <string.h> #include <string.h>
#include "cmdlgtst.h" #include "cmdlgtst.h"
// This structure is to set up flag / control associations for the custom /*
// requesters. The ft_id is the id for the control (usually generated * This structure is to set up flag / control associations for the custom
// by the system) and the ft_bit is the flag bit which goes into the * requesters. The ft_id is the id for the control (usually generated
// settings longword for the various Commdlg structures. It is assumed * by the system) and the ft_bit is the flag bit which goes into the
// that all flags fit in an unsigned long and that all bits are in fact * settings longword for the various Commdlg structures. It is assumed
// one bit. * that all flags fit in an unsigned long and that all bits are in fact
* one bit.
*/
// The array of entries is terminated by {IDOK, 0}; the assumption is that /*
// IDOK would never be associated with a dialogbox control (since it's * The array of entries is terminated by {IDOK, 0}; the assumption is that
// usually the ID of the OK button}. * IDOK would never be associated with a dialogbox control (since it's
* usually the ID of the OK button}.
*/
struct FlagTableEntry { struct FlagTableEntry {
int ft_id; int ft_id;
unsigned long ft_bit; unsigned long ft_bit;
}; };
//#define FAR #if 0
#define FAR
#endif
#define EXPORT #define EXPORT
static char menuName[] = "CmdlgtstMenu"; static char menuName[] = "CmdlgtstMenu";
static char className[] = "CmdlgtstClass"; static char className[] = "CmdlgtstClass";
static char windowName[] = "Cmdlgtst Window"; static char windowName[] = "Cmdlgtst Window";
// global hInstance variable. This makes the code non-threadable, /*
// but wotthehell; this is Win32 anyway! (Though it does work * global hInstance variable. This makes the code non-threadable,
// under Win16, if one doesn't run more than one copy at a time.) * but wotthehell; this is Win32 anyway! (Though it does work
* under Win16, if one doesn't run more than one copy at a time.)
*/
static HINSTANCE g_hInstance; static HINSTANCE g_hInstance;
// global CommDlg data structures for modals. These are placed here /*
// so that the custom dialog boxes can get at them. * global CommDlg data structures for modals. These are placed here
* so that the custom dialog boxes can get at them.
*/
static PRINTDLG pd; static PRINTDLG pd;
static COLORREF cc_cr[16]; static COLORREF cc_cr[16];
@ -60,7 +75,7 @@ static char ofn_result[1024];
static char ofn_titleresult[128]; static char ofn_titleresult[128];
static OPENFILENAME ofn; static OPENFILENAME ofn;
// Stuff for find and replace. These are modeless, so I have to put them here. /* Stuff for find and replace. These are modeless, so I have to put them here. */
static HWND findDialogBox = 0; static HWND findDialogBox = 0;
static UINT findMessageId = 0; static UINT findMessageId = 0;
@ -68,39 +83,43 @@ static UINT findMessageId = 0;
static FINDREPLACE frS; static FINDREPLACE frS;
static char fromstring[1024], tostring[1024]; static char fromstring[1024], tostring[1024];
// Stuff for the drawing of the window(s). I put them here for convenience. /* Stuff for the drawing of the window(s). I put them here for convenience. */
static COLORREF fgColor = RGB(0, 0, 0); // not settable static COLORREF fgColor = RGB(0, 0, 0); /* not settable */
static COLORREF bgColor = RGB(255, 255, 255); // COLOR dialog static COLORREF bgColor = RGB(255, 255, 255); /* COLOR dialog */
static COLORREF txtColor = RGB(0, 0, 0); // settable if one enables CF_EFFECTS static COLORREF txtColor = RGB(0, 0, 0); /* settable if one enables CF_EFFECTS */
// Utility routines. /* Utility routines. */
void nyi(HWND hWnd) void nyi(HWND hWnd)
{ {
// "Hi there! I'm not yet implemented!" /* "Hi there! I'm not yet implemented!" */
MessageBox(hWnd, "Not yet implemented!", "NYI", MB_ICONEXCLAMATION | MB_OK); MessageBox(hWnd, "Not yet implemented!", "NYI", MB_ICONEXCLAMATION | MB_OK);
} }
UINT CALLBACK dummyfnHook(HWND hWnd, UINT msg, UINT wParam, UINT lParam) UINT CALLBACK dummyfnHook(HWND hWnd, UINT msg, UINT wParam, UINT lParam)
{ {
// If the user specifies something that needs an awfully stupid hook function, /*
// this is the one to use. It's a no-op, and says "I didn't do anything." * If the user specifies something that needs an awfully stupid hook function,
* this is the one to use. It's a no-op, and says "I didn't do anything."
*/
(void) hWnd; (void) hWnd;
(void) msg; (void) msg;
(void) wParam; (void) wParam;
(void) lParam; (void) lParam;
printf("dummyfnhook\n"); // visible under Wine, but Windows probably won't see it! printf("dummyfnhook\n"); /* visible under Wine, but Windows probably won't see it! */
return 0; return 0;
} }
// Initialization code. This code simply shoves in predefined /*
// data into the COMMDLG data structures; in the future, I might use * Initialization code. This code simply shoves in predefined
// a series of loadable resources, or static initializers; of course, * data into the COMMDLG data structures; in the future, I might use
// if Microsoft decides to change the field ordering, I'd be screwed. * a series of loadable resources, or static initializers; of course,
* if Microsoft decides to change the field ordering, I'd be screwed.
*/
void mwi_Print(HWND hWnd) void mwi_Print(HWND hWnd)
{ {
@ -126,7 +145,7 @@ void mwi_Color(HWND hWnd)
{ {
int i; int i;
// there's probably an init call for this, somewhere. /* there's probably an init call for this, somewhere. */
for(i=0;i<16;i++) for(i=0;i<16;i++)
cc_cr[i] = RGB(0,0,0); cc_cr[i] = RGB(0,0,0);
@ -148,8 +167,8 @@ void mwi_Font(HWND hWnd)
cf.hwndOwner = hWnd; cf.hwndOwner = hWnd;
cf.hDC = 0; cf.hDC = 0;
cf.lpLogFont = &cf_lf; cf.lpLogFont = &cf_lf;
cf.Flags = CF_SCREENFONTS; // something's needed for display; otherwise it craps out with an error cf.Flags = CF_SCREENFONTS; /* something's needed for display; otherwise it craps out with an error */
cf.rgbColors = RGB(0,0,0); // what is *this* doing here?? cf.rgbColors = RGB(0,0,0); /* what is *this* doing here?? */
cf.lCustData = 0; cf.lCustData = 0;
cf.lpfnHook = 0; cf.lpfnHook = 0;
cf.lpTemplateName = 0; cf.lpTemplateName = 0;
@ -159,7 +178,7 @@ void mwi_Font(HWND hWnd)
cf.nSizeMin = 8; cf.nSizeMin = 8;
cf.nSizeMax = 72; cf.nSizeMax = 72;
cf_lf.lfHeight = -18; // this can be positive or negative, but negative is usually used. cf_lf.lfHeight = -18; /* this can be positive or negative, but negative is usually used. */
} }
void mwi_File(HWND hWnd) void mwi_File(HWND hWnd)
@ -216,12 +235,14 @@ void mwi_InitAll(HWND hWnd)
mwi_FindReplace(hWnd); mwi_FindReplace(hWnd);
} }
// Various configurations for the window. Ideally, this /*
// would be stored with the window itself, but then, this * Various configurations for the window. Ideally, this
// isn't the brightest of apps. Wouldn't be hard to set up, * would be stored with the window itself, but then, this
// though -- one of the neater functions of Windows, but if * isn't the brightest of apps. Wouldn't be hard to set up,
// someone decides to load the windows themselves from resources, * though -- one of the neater functions of Windows, but if
// there might be a problem. * someone decides to load the windows themselves from resources,
* there might be a problem.
*/
void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{ {
@ -235,7 +256,7 @@ void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
(void) wParam; (void) wParam;
(void) lParam; (void) lParam;
// Commence painting! /* Commence painting! */
BeginPaint(hWnd, &ps); BeginPaint(hWnd, &ps);
GetClientRect(hWnd, (LPRECT) &rect); GetClientRect(hWnd, (LPRECT) &rect);
@ -244,20 +265,22 @@ void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
brush = (HBRUSH) SelectObject(ps.hdc, CreateSolidBrush(bgColor)); brush = (HBRUSH) SelectObject(ps.hdc, CreateSolidBrush(bgColor));
font = (HFONT) SelectObject(ps.hdc, CreateFontIndirect(&cf_lf)); font = (HFONT) SelectObject(ps.hdc, CreateFontIndirect(&cf_lf));
// Ideally, we'd only need to draw the exposed bit. /*
// But something in BeginPaint is screwing up the rectangle. * Ideally, we'd only need to draw the exposed bit.
// Either that, or Windows is drawing it wrong. AARGH! * But something in BeginPaint is screwing up the rectangle.
// Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); * Either that, or Windows is drawing it wrong. AARGH!
* Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
*/
Rectangle(ps.hdc, rect.left, rect.top, rect.right, rect.bottom); Rectangle(ps.hdc, rect.left, rect.top, rect.right, rect.bottom);
// now draw a couple of lines, just for giggles. /* now draw a couple of lines, just for giggles. */
MoveToEx(ps.hdc, rect.left, rect.top, (POINT FAR *) 0); MoveToEx(ps.hdc, rect.left, rect.top, (POINT FAR *) 0);
LineTo(ps.hdc, rect.right, rect.bottom); LineTo(ps.hdc, rect.right, rect.bottom);
MoveToEx(ps.hdc, rect.left, rect.bottom, (POINT FAR *) 0); MoveToEx(ps.hdc, rect.left, rect.bottom, (POINT FAR *) 0);
LineTo(ps.hdc, rect.right, rect.top); LineTo(ps.hdc, rect.right, rect.top);
// draw some text /* draw some text */
SetTextAlign(ps.hdc, TA_CENTER|TA_BASELINE); SetTextAlign(ps.hdc, TA_CENTER|TA_BASELINE);
SetTextColor(ps.hdc, txtColor); SetTextColor(ps.hdc, txtColor);
@ -267,8 +290,10 @@ void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
TextOut(ps.hdc, rect.left+10, rect.top+10, ofn_result, strlen(ofn_result)); TextOut(ps.hdc, rect.left+10, rect.top+10, ofn_result, strlen(ofn_result));
TextOut(ps.hdc, rect.left+10, rect.top-cf_lf.lfHeight+10, ofn_titleresult, strlen(ofn_titleresult)); TextOut(ps.hdc, rect.left+10, rect.top-cf_lf.lfHeight+10, ofn_titleresult, strlen(ofn_titleresult));
// set the HDC back to the old pen and brush, /*
// and delete the newly created objects. * set the HDC back to the old pen and brush,
* and delete the newly created objects.
*/
pen = (HPEN) SelectObject(ps.hdc, pen); pen = (HPEN) SelectObject(ps.hdc, pen);
DeleteObject(pen); DeleteObject(pen);
@ -280,10 +305,12 @@ void paintMainWindow(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
// This function simply returns an error indication. Naturally, /*
// I do not (yet) see an elegant method by which one can convert * This function simply returns an error indication. Naturally,
// the CDERR_xxx return values into something resembling usable text; * I do not (yet) see an elegant method by which one can convert
// consult cderr.h to see what was returned. * the CDERR_xxx return values into something resembling usable text;
* consult cderr.h to see what was returned.
*/
void mw_checkError(HWND hWnd, BOOL explicitcancel) void mw_checkError(HWND hWnd, BOOL explicitcancel)
{ {
@ -299,10 +326,12 @@ void mw_checkError(HWND hWnd, BOOL explicitcancel)
} }
} }
// The actual dialog function calls. These merely wrap the Commdlg /*
// calls, and do something (not so) intelligent with the result. * The actual dialog function calls. These merely wrap the Commdlg
// Ideally, the main window would refresh and take into account the * calls, and do something (not so) intelligent with the result.
// various values specified in the dialog. * Ideally, the main window would refresh and take into account the
* various values specified in the dialog.
*/
void mw_ColorSetup(HWND hWnd) void mw_ColorSetup(HWND hWnd)
{ {
@ -363,8 +392,10 @@ void mw_SaveSetup(HWND hWnd)
else mw_checkError(hWnd,FALSE); else mw_checkError(hWnd,FALSE);
} }
// Can't find documentation in Borland for this one. Does it /*
// exist at all, or is it merely a subdialog of Print? * Can't find documentation in Borland for this one. Does it
* exist at all, or is it merely a subdialog of Print?
*/
void mw_PSetupSetup(HWND hWnd) void mw_PSetupSetup(HWND hWnd)
{ {
@ -374,20 +405,26 @@ void mw_PSetupSetup(HWND hWnd)
void mw_PrintSetup(HWND hWnd) void mw_PrintSetup(HWND hWnd)
{ {
if(PrintDlg(&pd)) { if(PrintDlg(&pd)) {
// the following are suggested in the Borland documentation, /*
// but aren't that useful until WinE starts to actually * the following are suggested in the Borland documentation,
// function with respect to printing. * but aren't that useful until WinE starts to actually
* function with respect to printing.
*/
// Escape(tmp.hDC, STARTDOC, 8, "Test-Doc", NULL); #if 0
Escape(tmp.hDC, STARTDOC, 8, "Test-Doc", NULL);
#endif
/* Print text and rectangle */ /* Print text and rectangle */
// TextOut(tmp.hDC, 50, 50, "Common Dialog Test Page", 23); #if 0
TextOut(tmp.hDC, 50, 50, "Common Dialog Test Page", 23);
// Rectangle(tmp.hDC, 50, 90, 625, 105); Rectangle(tmp.hDC, 50, 90, 625, 105);
// Escape(tmp.hDC, NEWFRAME, 0, NULL, NULL); Escape(tmp.hDC, NEWFRAME, 0, NULL, NULL);
// Escape(tmp.hDC, ENDDOC, 0, NULL, NULL); Escape(tmp.hDC, ENDDOC, 0, NULL, NULL);
// DeleteDC(tmp.hDC); DeleteDC(tmp.hDC);
#endif
if (pd.hDevMode != 0) if (pd.hDevMode != 0)
GlobalFree(pd.hDevMode); GlobalFree(pd.hDevMode);
if (pd.hDevNames != 0) if (pd.hDevNames != 0)
@ -401,8 +438,10 @@ void mw_PrintSetup(HWND hWnd)
else mw_checkError(hWnd,TRUE); else mw_checkError(hWnd,TRUE);
} }
// Some support functions for the custom dialog box handlers. /*
// In particular, we have to set things properly, and get the flags back. * Some support functions for the custom dialog box handlers.
* In particular, we have to set things properly, and get the flags back.
*/
void mwcd_SetFlags(HWND hWnd, struct FlagTableEntry *table, unsigned long flags) void mwcd_SetFlags(HWND hWnd, struct FlagTableEntry *table, unsigned long flags)
{ {
@ -428,10 +467,12 @@ unsigned long mwcd_GetFlags(HWND hWnd, struct FlagTableEntry * table)
return l; return l;
} }
// These functions are the custom dialog box handlers. /*
// The division of labor may be a tad peculiar; in particular, * These functions are the custom dialog box handlers.
// the flag tables should probably be in the main functions, * The division of labor may be a tad peculiar; in particular,
// not the handlers. I'll fix that later; this works as of right now. * the flag tables should probably be in the main functions,
* not the handlers. I'll fix that later; this works as of right now.
*/
BOOL mwcd_Setup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL mwcd_Setup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
struct FlagTableEntry * table, unsigned long * flags) struct FlagTableEntry * table, unsigned long * flags)
@ -441,12 +482,12 @@ BOOL mwcd_Setup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
switch(uMsg) switch(uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
// Set the controls properly. /* Set the controls properly. */
mwcd_SetFlags(hWnd, table, *flags); mwcd_SetFlags(hWnd, table, *flags);
return TRUE; // I would return FALSE if I explicitly called SetFocus(). return TRUE; /* I would return FALSE if I explicitly called SetFocus(). */
// As usual, Windows is weird. /* As usual, Windows is weird. */
case WM_COMMAND: case WM_COMMAND:
switch(wParam) { switch(wParam) {
@ -460,15 +501,15 @@ BOOL mwcd_Setup(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
break; break;
case CM_R_HELP: case CM_R_HELP:
break; // help? We don't need no steenkin help! break; /* help? We don't need no steenkin help! */
default: default:
break; // eat the message break; /* eat the message */
} }
return TRUE; return TRUE;
default: default:
return FALSE; // since I don't process this particular message return FALSE; /* since I don't process this particular message */
} }
} }
@ -609,17 +650,18 @@ BOOL CALLBACK mwcd_About(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
(void) lParam; (void) lParam;
switch(uMsg) { switch(uMsg) {
case WM_INITDIALOG: return TRUE; // let WINDOWS set the focus. case WM_INITDIALOG: return TRUE; /* let WINDOWS set the focus. */
case WM_COMMAND: EndDialog(hWnd, 0); return TRUE; // it's our OK button. case WM_COMMAND: EndDialog(hWnd, 0); return TRUE; /* it's our OK button. */
default: return FALSE; // it's something else, let Windows worry about it default: return FALSE; /* it's something else, let Windows worry about it */
} }
} }
/*
// These functions call custom dialog boxes (resource-loaded, if I do this right). * These functions call custom dialog boxes (resource-loaded, if I do this right).
// Right now they don't do a heck of a lot, but at some future time * Right now they don't do a heck of a lot, but at some future time
// they will muck about with the flags (and be loaded from the flags) of * they will muck about with the flags (and be loaded from the flags) of
// the CommDlg structures initialized by the mwi_xxx() routines. * the CommDlg structures initialized by the mwi_xxx() routines.
*/
void mwc_ColorSetup(HWND hWnd) void mwc_ColorSetup(HWND hWnd)
{ {
@ -651,10 +693,12 @@ void mwc_FileSetup(HWND hWnd)
if(r < 0) { MessageBox(hWnd, "Failure opening File_Flags_Dialog box", "Error", MB_ICONASTERISK|MB_OK); } if(r < 0) { MessageBox(hWnd, "Failure opening File_Flags_Dialog box", "Error", MB_ICONASTERISK|MB_OK); }
} }
// Main window message dispatcher. Here the messages get chewed up /*
// and spit out. Note the ugly hack for the modeless Find/Replace box; * Main window message dispatcher. Here the messages get chewed up
// this looks like it was bolted on with hexhead screws and is now * and spit out. Note the ugly hack for the modeless Find/Replace box;
// dangling from Windows like a loose muffler. Sigh. * this looks like it was bolted on with hexhead screws and is now
* dangling from Windows like a loose muffler. Sigh.
*/
LRESULT CALLBACK EXPORT mainWindowDispatcher( LRESULT CALLBACK EXPORT mainWindowDispatcher(
HWND hWnd, HWND hWnd,
@ -686,31 +730,33 @@ LRESULT CALLBACK EXPORT mainWindowDispatcher(
} }
else switch(uMsg) { else switch(uMsg) {
case WM_CREATE: case WM_CREATE:
// this is always the first message...at least as far as /*
// we are concerned. * this is always the first message...at least as far as
* we are concerned.
*/
mwi_InitAll(hWnd); mwi_InitAll(hWnd);
break; break;
case WM_PAINT: case WM_PAINT:
// Well, draw something! /* Well, draw something! */
paintMainWindow(hWnd, uMsg, wParam, lParam); paintMainWindow(hWnd, uMsg, wParam, lParam);
break; break;
case WM_DESTROY: case WM_DESTROY:
// Uh oh. Eject! Eject! Eject! /* Uh oh. Eject! Eject! Eject! */
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_COMMAND: case WM_COMMAND:
// menu or accelerator pressed; do something. /* menu or accelerator pressed; do something. */
switch(wParam) { switch(wParam) {
case CM_U_EXIT: case CM_U_EXIT:
// Uh oh. Eject! Eject! Eject! /* Uh oh. Eject! Eject! Eject! */
PostQuitMessage(0); PostQuitMessage(0);
break; break;
// these actually call the Common Dialogs. /* these actually call the Common Dialogs. */
case CM_U_COLOR: case CM_U_COLOR:
mw_ColorSetup(hWnd); return 1; mw_ColorSetup(hWnd); return 1;
@ -736,9 +782,11 @@ LRESULT CALLBACK EXPORT mainWindowDispatcher(
case CM_U_PRINT: case CM_U_PRINT:
mw_PrintSetup(hWnd); return 1; mw_PrintSetup(hWnd); return 1;
// these set up various flags and values in the Common Dialog /*
// data structures, which are currently stored in static memory. * these set up various flags and values in the Common Dialog
// The control dialogs themselves are resources as well. * data structures, which are currently stored in static memory.
* The control dialogs themselves are resources as well.
*/
case CM_F_FILE: case CM_F_FILE:
mwc_FileSetup(hWnd); return 1; mwc_FileSetup(hWnd); return 1;
@ -760,7 +808,7 @@ LRESULT CALLBACK EXPORT mainWindowDispatcher(
return 1; return 1;
case CM_H_USAGE: case CM_H_USAGE:
DialogBox(g_hInstance, "UsageDialog", hWnd, (DLGPROC) mwcd_About); DialogBox(g_hInstance, "UsageDialog", hWnd, (DLGPROC) mwcd_About);
// return value? *What* return value? /* return value? *What* return value? */
return 1; return 1;
default: default:
@ -774,7 +822,7 @@ LRESULT CALLBACK EXPORT mainWindowDispatcher(
return 0; return 0;
} }
// Class registration. One might call this a Windowsism. /* Class registration. One might call this a Windowsism. */
int registerMainWindowClass(HINSTANCE hInstance) int registerMainWindowClass(HINSTANCE hInstance)
{ {
@ -785,8 +833,10 @@ int registerMainWindowClass(HINSTANCE hInstance)
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0; wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance; wndClass.hInstance = hInstance;
//wndClass.hIcon = LoadIcon(hInstance, "whello"); #if 0
//wndClass.hCursor = LoadCursor(hInstance, IDC_ARROW); wndClass.hIcon = LoadIcon(hInstance, "whello");
wndClass.hCursor = LoadCursor(hInstance, IDC_ARROW);
#endif
wndClass.hIcon = 0; wndClass.hIcon = 0;
wndClass.hCursor = 0; wndClass.hCursor = 0;
wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
@ -796,26 +846,28 @@ int registerMainWindowClass(HINSTANCE hInstance)
return RegisterClass(&wndClass); return RegisterClass(&wndClass);
} }
// Another Windowsism; this one's not too bad, as it compares /*
// favorably with CreateWindow() in X (mucking about with X Visuals * Another Windowsism; this one's not too bad, as it compares
// can get messy; at least here we don't have to worry about that). * favorably with CreateWindow() in X (mucking about with X Visuals
* can get messy; at least here we don't have to worry about that).
*/
HWND createMainWindow(HINSTANCE hInstance, int show) HWND createMainWindow(HINSTANCE hInstance, int show)
{ {
HWND hWnd; HWND hWnd;
hWnd = CreateWindow( hWnd = CreateWindow(
className, // classname className, /* classname */
windowName, // windowname/title windowName, /* windowname/title */
WS_OVERLAPPEDWINDOW, // dwStyle WS_OVERLAPPEDWINDOW, /* dwStyle */
0, //x 0, /* x */
0, //y 0, /* y */
CW_USEDEFAULT, //width CW_USEDEFAULT, /* width */
CW_USEDEFAULT, //height CW_USEDEFAULT, /* height */
0, // parent window 0, /* parent window */
0, // menu 0, /* menu */
hInstance, // instance hInstance, /* instance */
0 // passthrough for MDI 0 /* passthrough for MDI */
); );
if(hWnd==0) return 0; if(hWnd==0) return 0;
@ -841,12 +893,14 @@ int messageLoop(HINSTANCE hInstance, HWND hWnd)
return msg.wParam; return msg.wParam;
} }
// Oh, did we tell you that main() isn't the name of the /*
// thing called in a Win16/Win32 app? And then there are * Oh, did we tell you that main() isn't the name of the
// the lack of argument lists, the necessity (at least in Win16) * thing called in a Win16/Win32 app? And then there are
// of having to deal with class registration exactly once (as the * the lack of argument lists, the necessity (at least in Win16)
// app may be run again), and some other bizarre holdovers from * of having to deal with class registration exactly once (as the
// Windows 3.x days. But hey, Solitaire still works. * app may be run again), and some other bizarre holdovers from
* Windows 3.x days. But hey, Solitaire still works.
*/
int PASCAL WinMain( int PASCAL WinMain(
HINSTANCE hInstance, HINSTANCE hPrevInstance, HINSTANCE hInstance, HINSTANCE hPrevInstance,
@ -873,8 +927,9 @@ int PASCAL WinMain(
return messageLoop(hInstance, hWnd); return messageLoop(hInstance, hWnd);
} }
// And now the end of the program. Enjoy. /* And now the end of the program. Enjoy. */
// (c) 1999-2000 Eric Williams. Rights as specified under the WINE
// License. Don't hoard code; share it!
/*
* (c) 1999-2000 Eric Williams. Rights as specified under the WINE
* License. Don't hoard code; share it!
*/

View file

@ -102,5 +102,3 @@ um diese Funktion \nabzuschlie
\nAnwendungen, um den verfügbaren Arbeitsspeicher zu \nerhöhen." \nAnwendungen, um den verfügbaren Arbeitsspeicher zu \nerhöhen."
#include "notepad.rc" #include "notepad.rc"

View file

@ -150,7 +150,7 @@ void DoOpenFile(LPCSTR szFileName) {
WORD nResult; WORD nResult;
/* Close any files and prompt to save changes */ /* Close any files and prompt to save changes */
if (DoCloseFile) { if (DoCloseFile()) {
GetFileTitle(szFileName, Globals.szFileName, sizeof(Globals.szFileName)); GetFileTitle(szFileName, Globals.szFileName, sizeof(Globals.szFileName));
LANGUAGE_UpdateWindowCaption(); LANGUAGE_UpdateWindowCaption();
hFile = _lopen(szFileName, OF_READ); hFile = _lopen(szFileName, OF_READ);

View file

@ -160,60 +160,60 @@ static void processQueryValue(LPSTR cmdline);
/* /*
* Help Text displayed when invalid parameters are provided * Help Text displayed when invalid parameters are provided
*/ */
static char helpText[] = " static char helpText[] =
NAME "NAME\n"
regapi - provide a command line interface to the wine registry. " regapi - provide a command line interface to the wine registry.\n"
"\n"
SYNOPSIS "SYNOPSIS\n"
regapi commandName [-force] < file " regapi commandName [-force] < file\n"
"\n"
DESCRIPTION "DESCRIPTION\n"
regapi allows editing the wine registry. It processes the given " regapi allows editing the wine registry. It processes the given\n"
commandName for every line in the stdin data stream. Input data " commandName for every line in the stdin data stream. Input data\n"
format may vary depending on the commandName see INPUT FILE FORMAT. " format may vary depending on the commandName see INPUT FILE FORMAT.\n"
"\n"
OPTIONS "OPTIONS\n"
commandName " commandName\n"
Instruct regapi about what action to perform on the data stream. " Instruct regapi about what action to perform on the data stream.\n"
Currently, only setValue and queryValue are supported and " Currently, only setValue and queryValue are supported and\n"
implemented. " implemented.\n"
"\n"
-force " -force\n"
When provided the action will be performed anyway. This may " When provided the action will be performed anyway. This may\n"
have a different meaning depending on the context. For example, " have a different meaning depending on the context. For example,\n"
when providing -force to setValue, the value is set even if it " when providing -force to setValue, the value is set even if it\n"
was previously set to another value. " was previously set to another value.\n"
"\n"
< file " < file\n"
STDIN channel, provide a file name with line of the appropriate " STDIN channel, provide a file name with line of the appropriate\n"
format. " format.\n"
"\n"
INPUT FILE FORMAT "INPUT FILE FORMAT\n"
"\n"
setValue " setValue\n"
The input file format required by the setValue command is similar " The input file format required by the setValue command is similar\n"
to the one obtained from regedit.exe export option. The only " to the one obtained from regedit.exe export option. The only\n"
difference is that multi line values are not supported, the " difference is that multi line values are not supported, the\n"
value data must be on a single line. " value data must be on a single line.\n"
"\n"
[KEY_CLASS\\Some\\Path\\For\\A\\Key] " [KEY_CLASS\\Some\\Path\\For\\A\\Key]\n"
\"Value1\"=\"Data1\" " \"Value1\"=\"Data1\"\n"
\"Value2\"=\"Data2\" " \"Value2\"=\"Data2\"\n"
\"Valuen\"=\"Datan\" " \"Valuen\"=\"Datan\"\n"
... " ...\n"
"\n"
queryValue " queryValue\n"
The input file format required by the queryValue command is " The input file format required by the queryValue command is\n"
similar to the one required by setValue. The only " similar to the one required by setValue. The only\n"
difference is that you only provide the value name. " difference is that you only provide the value name.\n"
"\n"
[KEY_CLASS\\Some\\Path\\For\\A\\Key] " [KEY_CLASS\\Some\\Path\\For\\A\\Key]\n"
\"Value1\" " \"Value1\"\n"
\"Value2\" " \"Value2\"\n"
\"Valuen\" " \"Valuen\"\n"
... " ...\n"
February 1999. " February 1999.\n"
"; ;
/****************************************************************************** /******************************************************************************

View file

@ -20,6 +20,10 @@
#include <winerror.h> #include <winerror.h>
#include <winnt.h> #include <winnt.h>
#ifndef __GNUC__
#define __FUNCTION__ "<function>"
#endif
/* True this when security is implemented */ /* True this when security is implemented */
#define CHECK_SAM FALSE #define CHECK_SAM FALSE

View file

@ -26,9 +26,10 @@ BOOL isAldus;
BOOL FileOpen(HWND hWnd, char *fn) BOOL FileOpen(HWND hWnd, char *fn)
{ {
OPENFILENAME ofn = { sizeof(OPENFILENAME), OPENFILENAME ofn = { sizeof(OPENFILENAME),
0, 0, "Metafiles\0*.wmf\0", NULL, 0, 0, NULL, 0, 0, NULL, NULL, 0, 0, NULL,
FN_LENGTH, NULL, 0, NULL, NULL, OFN_CREATEPROMPT | FN_LENGTH, NULL, 0, NULL, NULL, OFN_CREATEPROMPT |
OFN_SHOWHELP, 0, 0, NULL, 0, NULL }; OFN_SHOWHELP, 0, 0, NULL, 0, NULL };
ofn.lpstrFilter = "Metafiles\0*.wmf\0";
ofn.hwndOwner = hWnd; ofn.hwndOwner = hWnd;
ofn.lpstrFile = fn; ofn.lpstrFile = fn;
return GetOpenFileName(&ofn); return GetOpenFileName(&ofn);

View file

@ -202,7 +202,9 @@ __int64 byte_count;
if ((recurse) && if ((recurse) &&
((fd+i)->cFileName[0] != '.') && ((fd+i)->cFileName[0] != '.') &&
((fd+i)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { ((fd+i)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
// GetFullPathName ((fd+i)->cFileName, sizeof(string), string, NULL); #if 0
GetFullPathName ((fd+i)->cFileName, sizeof(string), string, NULL);
#endif
p = strrchr (search_path, '\\'); p = strrchr (search_path, '\\');
lstrcpyn (string, search_path, (p-search_path+2)); lstrcpyn (string, search_path, (p-search_path+2));
lstrcat (string, (fd+i)->cFileName); lstrcat (string, (fd+i)->cFileName);

View file

@ -106,7 +106,9 @@ HANDLE h;
h = CreateFile (string, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); h = CreateFile (string, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (h != INVALID_HANDLE_VALUE) { if (h != INVALID_HANDLE_VALUE) {
CloseHandle (h); CloseHandle (h);
// WCMD_batch (string, " "); #if 0
WCMD_batch (string, " ");
#endif
} }
/* /*