- Get autochk, calc, cmd, devmgr, expand, format, gettype, hostname, lsass, msconfig...
[reactos.git] / reactos / subsys / system / regedit / hexedit.c
index a0596ed..032db28 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define WIN32_LEAN_AND_MEAN     /* Exclude rarely-used stuff from Windows headers */
-#include <windows.h>
-#include <commctrl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <tchar.h>
-
-#include "hexedit.h"
-
+#include <regedit.h>
 typedef struct
 {
   HWND hWndSelf;
@@ -34,10 +26,10 @@ typedef struct
   HLOCAL hBuffer;
   DWORD style;
   DWORD MaxBuffer;
-  DWORD ColumnsPerLine;
-  DWORD nLines;
-  DWORD nVisibleLinesComplete;
-  DWORD nVisibleLines;
+  INT ColumnsPerLine;
+  INT nLines;
+  INT nVisibleLinesComplete;
+  INT nVisibleLines;
   INT Position;
   INT LineHeight;
   INT CharWidth;
@@ -131,7 +123,7 @@ HEXEDIT_Update(PHEXEDIT_DATA hed)
   SCROLLINFO si;
   RECT rcClient;
   BOOL SbVisible;
-  DWORD bufsize, cvislines;
+  INT bufsize, cvislines;
 
   GetClientRect(hed->hWndSelf, &rcClient);
   hed->style = GetWindowLong(hed->hWndSelf, GWL_STYLE);
@@ -187,7 +179,8 @@ HEXEDIT_GetFixedFont(VOID)
 static VOID
 HEXEDIT_PaintLines(PHEXEDIT_DATA hed, HDC hDC, DWORD ScrollPos, DWORD First, DWORD Last, RECT *rc)
 {
-  DWORD x, dx, dy, linestart;
+  DWORD dx, dy, linestart;
+  INT x;
   PBYTE buf, current, end, line;
   UINT bufsize;
   TCHAR hex[3], addr[17];
@@ -515,7 +508,7 @@ HEXEDIT_WM_NCDESTROY(PHEXEDIT_DATA hed)
 {
   if(hed->hBuffer)
   {
-    while(LocalUnlock(hed->hBuffer));
+    //while(LocalUnlock(hed->hBuffer));
     LocalFree(hed->hBuffer);
   }
 
@@ -656,7 +649,7 @@ HEXEDIT_WM_PAINT(PHEXEDIT_DATA hed)
   SCROLLINFO si;
   RECT rc;
   HBITMAP hbmp, hbmpold;
-  DWORD nLines, nFirst;
+  INT nLines, nFirst;
   HFONT hOldFont;
   HDC hTempDC;
   DWORD height;
@@ -795,7 +788,7 @@ HEXEDIT_WM_KEYDOWN(PHEXEDIT_DATA hed, INT VkCode)
       break;
 
     case VK_RIGHT:
-      if(hed->Position < bufsize)
+      if(hed->Position < (INT)bufsize)
       {
         if(++hed->CaretCol > hed->ColumnsPerLine)
        {
@@ -826,13 +819,13 @@ HEXEDIT_WM_KEYDOWN(PHEXEDIT_DATA hed, INT VkCode)
       break;
 
     case VK_DOWN:
-      if(hed->Position <= bufsize)
+      if(hed->Position <= (INT)bufsize)
       {
         if(hed->CaretLine < hed->nLines - 1)
        {
          hed->Position += hed->ColumnsPerLine;
          hed->CaretLine++;
-         if(hed->Position > bufsize)
+         if(hed->Position > (INT)bufsize)
          {
            hed->Position = bufsize;
            hed->CaretLine = (hed->nLines > 0 ? hed->nLines - 1 : 0);
@@ -865,7 +858,7 @@ HexEditWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
   PHEXEDIT_DATA hed;
 
-  hed = (PHEXEDIT_DATA)GetWindowLongPtr(hWnd, (DWORD_PTR)0);
+  hed = (PHEXEDIT_DATA)(LONG_PTR)GetWindowLongPtr(hWnd, (DWORD_PTR)0);
   switch(uMsg)
   {
     case WM_ERASEBKGND: