[FREELDR] Diverse enhancements.
[reactos.git] / boot / freeldr / fdebug / fdebug.c
index 34ae5ae..25ecd40 100644 (file)
@@ -1,11 +1,13 @@
-// fdebug.cpp : Defines the entry point for the application.
-//
+/* fdebug.c : Defines the entry point for the application. */
+
+#include <tchar.h>
 
-#include <windows.h>
+#include <windef.h>
+#include <winbase.h>
+#include <wingdi.h>
+#include <winuser.h>
 #include <commdlg.h>
 #include <process.h>
-#include <stdio.h>
-#include <tchar.h>
 
 #include "resource.h"
 #include "rs232.h"
@@ -28,16 +30,16 @@ BOOL        bLocalEcho = FALSE;                            // Tells us if local
 HANDLE        hCaptureFile;                                // Handle to the capture file
 DWORD        dwThreadId = 0;                                // Thread id of RS232 communication thread
 
-// Foward declarations of functions included in this code module:
+// Forward declarations of functions included in this code module:
 ATOM                MyRegisterClass(HINSTANCE hInstance);
 BOOL                InitInstance(HINSTANCE, int);
 LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK    ConnectionDialogProc(HWND, UINT, WPARAM, LPARAM);
-LRESULT CALLBACK    CaptureDialogProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK    ConnectionDialogProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK    CaptureDialogProc(HWND, UINT, WPARAM, LPARAM);
 VOID                EnableFileMenuItemByID(UINT Id, BOOL Enable);
 VOID                CheckLocalEchoMenuItem(BOOL Checked);
-VOID                Rs232Thread(VOID* Parameter);
+VOID __cdecl        Rs232Thread(VOID* Parameter);
 
 int APIENTRY _tWinMain(HINSTANCE hInstance,
                        HINSTANCE hPrevInstance,
@@ -67,7 +69,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
     // Main message loop:
     while (GetMessage(&msg, NULL, 0, 0))
     {
-        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
+        if (!TranslateAccelerator(hMainWnd, hAccelTable, &msg))
         {
             TranslateMessage(&msg);
             DispatchMessage(&msg);
@@ -99,7 +101,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
     wcex.cbSize = sizeof(WNDCLASSEX);
 
     wcex.style            = CS_HREDRAW | CS_VREDRAW;
-    wcex.lpfnWndProc    = (WNDPROC)WndProc;
+    wcex.lpfnWndProc    = WndProc;
     wcex.cbClsExtra        = 0;
     wcex.cbWndExtra        = 0;
     wcex.hInstance        = hInstance;
@@ -210,7 +212,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         switch (wmId)
         {
         case IDM_ABOUT:
-           DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
+           DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, About);
            break;
         case IDM_EXIT:
            DestroyWindow(hWnd);
@@ -225,7 +227,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             }
             else
             {
-                if (DialogBox(hInst, (LPCTSTR)IDD_CONNECTION, hWnd, (DLGPROC)ConnectionDialogProc) == IDOK)
+                if (DialogBox(hInst, (LPCTSTR)IDD_CONNECTION, hWnd, ConnectionDialogProc) == IDOK)
                 {
                     bConnected = TRUE;
                     EnableFileMenuItemByID(IDM_FILE_DISCONNECT, TRUE);
@@ -247,7 +249,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             }
             break;
         case IDM_FILE_STARTCAPTURE:
-            if (DialogBox(hInst, (LPCTSTR)IDD_CAPTURE, hWnd, (DLGPROC)CaptureDialogProc) == IDOK)
+            if (DialogBox(hInst, (LPCTSTR)IDD_CAPTURE, hWnd, CaptureDialogProc) == IDOK)
             {
                 bCapturing = TRUE;
                 EnableFileMenuItemByID(IDM_FILE_STOPCAPTURE, TRUE);
@@ -283,6 +285,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
         break;
     case WM_PAINT:
         hdc = BeginPaint(hWnd, &ps);
+        (void)hdc; // FIXME
         EndPaint(hWnd, &ps);
         break;
     case WM_SIZE:
@@ -302,7 +305,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    return 0;
 }
 
-LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
     HWND    hLicenseEditWnd;
     TCHAR    strLicense[0x1000];
@@ -332,7 +335,7 @@ LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     return FALSE;
 }
 
-LRESULT CALLBACK ConnectionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK ConnectionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
     UNREFERENCED_PARAMETER(lParam);
 
@@ -362,7 +365,7 @@ LRESULT CALLBACK ConnectionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LP
     return FALSE;
 }
 
-LRESULT CALLBACK CaptureDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+INT_PTR CALLBACK CaptureDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 {
     OPENFILENAME    ofn;
 
@@ -436,7 +439,7 @@ VOID CheckLocalEchoMenuItem(BOOL Checked)
     CheckMenuItem(hFileMenu, IDM_FILE_LOCALECHO, MF_BYCOMMAND|(Checked ? MF_CHECKED : MF_UNCHECKED));
 }
 
-VOID Rs232Thread(VOID* Parameter)
+VOID __cdecl Rs232Thread(VOID* Parameter)
 {
     BYTE    Byte;
     TCHAR    String[MAX_PATH];