First patch: Regedit Multi-String Value

Mike McCormack mike at
Mon Apr 24 02:41:15 CDT 2006

Hedos wrote:

> It is quite simple and definitly not concerning Wine's core code, but I  
> thought it'd be a good start.

Hi Philippe,

I had a quick look at your patch, and here are my comments:

+        if( !(newString = (TCHAR*)HeapAlloc(GetProcessHeap(), 0, 
lenbytes)) )
+            return NULL;
+        memset((LPBYTE)newString, 0, lenbytes);
+        int i = 0, charcount = 0, newlinepos = 0;

There's no need to cast HeapAlloc returns or memset arguments.

You shouldn't declare "int i..." inline, as that isn't compatible with 
some compilers that Wine aims to support.

+                if(newLine) { //If last iteration was also a new line, 
this is an empty new line

We don't use C++ style comments for better compiler compatibility too.

+                HeapFree(GetProcessHeap(), 0, newString);
+                if (lRet == ERROR_SUCCESS) result = TRUE;
+                else error_code_messagebox(hwnd, lRet);
+            } else HeapFree(GetProcessHeap(), 0, newString);

The HeapFree() calls are common to both code pathes here, why not just 
do a single HeapFree() call?

+++ programs/regedit/main.c     24 Apr 2006 06:41:43 -0000
@@ -182,6 +182,8 @@ int APIENTRY WinMain(HINSTANCE hInstance
      hAccel = LoadAccelerators(hInstance, (LPCTSTR)IDC_REGEDIT);

+       SetWindowText(hFrameWnd, "test v1.0");

Perhaps you meant to remove the above line before sending the patch?

Please try copy the coding style (curly brace placement, indentation and 
comments style) of the file you're changing, so we don't end up with a 
mismash of coding styles in each file.


More information about the wine-devel mailing list