Removed unnecessary HANDLE typecasts.

diff --git a/controls/button.c b/controls/button.c
index c0e7790..d4fac46 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -1094,7 +1094,7 @@
     if (GetClipRgn(hDC, clipRegion) != 1)
     {
 	DeleteObject(clipRegion);
-	clipRegion=(HRGN)NULL;
+	clipRegion=NULL;
     }
     clipRect = dis.rcItem;
     DPtoLP(hDC, (LPPOINT) &clipRect, 2);
diff --git a/controls/combo.c b/controls/combo.c
index 830922e..d94f984 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -312,7 +312,7 @@
    * message.
    */
   SetWindowPos( lphc->self,
-		(HWND)NULL,
+		NULL,
 		0, 0,
 		windowRect.right  - windowRect.left,
 		newComboHeight,
@@ -822,7 +822,7 @@
        if (GetClipRgn(hdc, clipRegion)!=1)
        {
 	 DeleteObject(clipRegion);
-	 clipRegion=(HRGN)NULL;
+	 clipRegion=NULL;
        }
 
        if (!IsWindowEnabled(lphc->self) & WS_DISABLED) itemState |= ODS_DISABLED;
diff --git a/controls/edit.c b/controls/edit.c
index 9149d0d..66b9874 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -2169,7 +2169,7 @@
 		es->format_rect.bottom = es->format_rect.top + es->line_height;
 
 	if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
-		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 }
 
 
@@ -2779,7 +2779,7 @@
 		GetClientRect(es->hwndSelf, &rc1);
 		IntersectRect(&rc, &rc1, &es->format_rect);
 		ScrollWindowEx(es->hwndSelf, -dx, dy,
-				NULL, &rc, (HRGN)NULL, NULL, SW_INVALIDATE);
+				NULL, &rc, NULL, NULL, SW_INVALIDATE);
 		/* force scroll info update */
 		EDIT_UpdateScrollInfo(es);
 	}
@@ -3143,7 +3143,7 @@
 	    if(es->hloc32A)
 	    {
 		LocalFree(es->hloc32A);
-		es->hloc32A = (HLOCAL)NULL;
+		es->hloc32A = NULL;
 	    }
 	    es->hloc32W = hloc;
 	}
@@ -3183,7 +3183,7 @@
 	EDIT_EM_EmptyUndoBuffer(es);
 	es->flags &= ~EF_MODIFIED;
 	es->flags &= ~EF_UPDATE;
-	EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+	EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 	EDIT_UpdateText(es, NULL, TRUE);
 	EDIT_EM_ScrollCaret(es);
 	/* force scroll info update */
@@ -3219,7 +3219,7 @@
 	if(es->hloc32A)
 	{
 	    LocalFree(es->hloc32A);
-	    es->hloc32A = (HLOCAL)NULL;
+	    es->hloc32A = NULL;
 	}
 
 	countA = LOCAL_Size(hInstance, hloc);
@@ -3250,7 +3250,7 @@
 	EDIT_EM_EmptyUndoBuffer(es);
 	es->flags &= ~EF_MODIFIED;
 	es->flags &= ~EF_UPDATE;
-	EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+	EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 	EDIT_UpdateText(es, NULL, TRUE);
 	EDIT_EM_ScrollCaret(es);
 	/* force scroll info update */
@@ -3460,7 +3460,7 @@
 	es->word_break_proc16 = NULL;
 
 	if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) {
-		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 		EDIT_UpdateText(es, NULL, TRUE);
 	}
 }
@@ -3479,7 +3479,7 @@
 	es->word_break_proc = NULL;
 	es->word_break_proc16 = wbp;
 	if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) {
-		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 		EDIT_UpdateText(es, NULL, TRUE);
 	}
 }
@@ -4527,7 +4527,7 @@
 	EDIT_SetRectNP(es, &r);
 
 	if (es->style & ES_MULTILINE)
-		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, (HRGN)0);
+		EDIT_BuildLineDefs_ML(es, 0, strlenW(es->text), 0, NULL);
 	else
 	    EDIT_CalcLineWidth_SL(es);
 
diff --git a/dlls/avifil32/acmstream.c b/dlls/avifil32/acmstream.c
index eaa8109..771b0c4 100644
--- a/dlls/avifil32/acmstream.c
+++ b/dlls/avifil32/acmstream.c
@@ -162,11 +162,11 @@
 
   if (This->ref == 0) {
     /* destruct */
-    if (This->has != (HACMSTREAM)NULL) {
+    if (This->has != NULL) {
       if (This->acmStreamHdr.fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)
 	acmStreamUnprepareHeader(This->has, &This->acmStreamHdr, 0);
       acmStreamClose(This->has, 0);
-      This->has = (HACMSTREAM)NULL;
+      This->has = NULL;
     }
     if (This->acmStreamHdr.pbSrc != NULL) {
       GlobalFreePtr(This->acmStreamHdr.pbSrc);
@@ -271,7 +271,7 @@
     return AVIERR_BADSIZE;
 
   /* Need codec to correct some values in structure */
-  if (This->has == (HACMSTREAM)NULL) {
+  if (This->has == NULL) {
     HRESULT hr = AVIFILE_OpenCompressor(This);
 
     if (FAILED(hr))
@@ -323,7 +323,7 @@
   if (formatsize == NULL)
     return AVIERR_BADPARAM;
 
-  if (This->has == (HACMSTREAM)NULL) {
+  if (This->has == NULL) {
     HRESULT hr = AVIFILE_OpenCompressor(This);
 
     if (FAILED(hr))
@@ -413,7 +413,7 @@
     *samplesread = 0;
 
   /* Do we have our compressor? */
-  if (This->has == (HACMSTREAM)NULL) {
+  if (This->has == NULL) {
     hr = AVIFILE_OpenCompressor(This);
 
     if (FAILED(hr))
@@ -540,7 +540,7 @@
     return AVIERR_READONLY;
 
   /* also need a compressor */
-  if (This->has == (HACMSTREAM)NULL)
+  if (This->has == NULL)
     return AVIERR_NOCOMPRESSOR;
 
   /* map our sizes to pStream sizes */
@@ -629,7 +629,7 @@
     return AVIERR_READONLY;
 
   /* A compressor is also neccessary */
-  if (This->has == (HACMSTREAM)NULL)
+  if (This->has == NULL)
     return AVIERR_NOCOMPRESSOR;
 
   /* map our positions to pStream positions */
@@ -681,7 +681,7 @@
   assert(This != NULL);
   assert(This->pStream != NULL);
 
-  if (This->has != (HACMSTREAM)NULL)
+  if (This->has != NULL)
     return AVIERR_OK;
 
   if (This->lpInFormat == NULL) {
diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c
index 40dfe24..60ac382 100644
--- a/dlls/avifil32/api.c
+++ b/dlls/avifil32/api.c
@@ -1224,7 +1224,7 @@
 
 	    hic = ICLocate(ICTYPE_VIDEO, sInfo.fccHandler, lpFormat,
 			   NULL, ICMODE_DECOMPRESS);
-	    if (hic != (HIC)NULL) {
+	    if (hic != NULL) {
 	      if (ICGetInfo(hic, &icinfo, sizeof(icinfo)) == S_OK)
 		lstrcatW(szFormat, icinfo.szDescription);
 	      ICClose(hic);
@@ -1249,7 +1249,7 @@
 	  afd.cbStruct      = sizeof(afd);
 	  afd.pwfx          = lpFormat;
 
-	  if (acmFormatTagDetailsW((HACMDRIVER)NULL, &aftd,
+	  if (acmFormatTagDetailsW(NULL, &aftd,
 				   ACM_FORMATTAGDETAILSF_FORMATTAG) == S_OK) {
 	    if (acmFormatDetailsW(NULL,&afd,ACM_FORMATDETAILSF_FORMAT) == S_OK)
 	      wsprintfW(szFormat, szAudioFmt, afd.szFormat, aftd.szFormatTag);
diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index 426052f..a1afa0d 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -318,9 +318,9 @@
       LocalFree((HLOCAL)This->szFileName);
       This->szFileName = NULL;
     }
-    if (This->hmmio != (HMMIO)NULL) {
+    if (This->hmmio != NULL) {
       mmioClose(This->hmmio, 0);
-      This->hmmio = (HMMIO)NULL;
+      This->hmmio = NULL;
     }
 
     LocalFree((HLOCAL)This);
@@ -586,7 +586,7 @@
     return AVIERR_BADPARAM;
 
   assert(This->paf != NULL);
-  if (This->paf->hmmio != (HMMIO)NULL)
+  if (This->paf->hmmio != NULL)
     return AVIERR_ERROR; /* No reuse of this object for another file! */
 
   /* remeber mode and name */
@@ -601,7 +601,7 @@
   /* try to open the file */
   This->paf->hmmio = mmioOpenW(This->paf->szFileName, NULL,
 			       MMIO_ALLOCBUF | dwMode);
-  if (This->paf->hmmio == (HMMIO)NULL)
+  if (This->paf->hmmio == NULL)
     return AVIERR_FILEOPEN;
 
   /* should we create a new file? */
@@ -1509,7 +1509,7 @@
   DWORD           nStream;
   HRESULT         hr;
 
-  if (This->hmmio == (HMMIO)NULL)
+  if (This->hmmio == NULL)
     return AVIERR_FILEOPEN;
 
   /* initialize stream ptr's */
@@ -1904,7 +1904,7 @@
   /* pre-conditions */
   assert(This != NULL);
   assert(This->paf != NULL);
-  assert(This->paf->hmmio != (HMMIO)NULL);
+  assert(This->paf->hmmio != NULL);
   assert(This->sInfo.dwStart <= pos && pos < This->sInfo.dwLength);
   assert(pos <= This->lLastFrame);
 
diff --git a/dlls/avifil32/extrachunk.c b/dlls/avifil32/extrachunk.c
index c0f7a75..cf70c5c 100644
--- a/dlls/avifil32/extrachunk.c
+++ b/dlls/avifil32/extrachunk.c
@@ -106,7 +106,7 @@
 
   /* pre-conditions */
   assert(extra != NULL);
-  assert(hmmio != (HMMIO)NULL);
+  assert(hmmio != NULL);
   assert(lpck  != NULL);
 
   cb  = lpck->cksize + 2 * sizeof(DWORD);
@@ -149,7 +149,7 @@
 
   /* pre-conditions */
   assert(extra != NULL);
-  assert(hmmio != (HMMIO)NULL);
+  assert(hmmio != NULL);
   assert(lpck  != NULL);
 
   TRACE("({%p,%lu},%p,%p,%p,0x%X)\n", extra->lp, extra->cb, hmmio, lpck,
diff --git a/dlls/avifil32/getframe.c b/dlls/avifil32/getframe.c
index 7e54811..e4f0d75 100644
--- a/dlls/avifil32/getframe.c
+++ b/dlls/avifil32/getframe.c
@@ -102,13 +102,13 @@
     GlobalFreePtr(This->lpInFormat);
     This->lpInFormat = NULL;
   }
-  if (This->hic != (HIC)NULL) {
+  if (This->hic != NULL) {
     if (This->bResize)
       ICDecompressExEnd(This->hic);
     else
       ICDecompressEnd(This->hic);
     ICClose(This->hic);
-    This->hic = (HIC)NULL;
+    This->hic = NULL;
   }
 }
 
@@ -260,7 +260,7 @@
 	This->lpInFormat->biSizeImage = readBytes;
 
 	/* nothing to decompress? */
-	if (This->hic == (HIC)NULL) {
+	if (This->hic == NULL) {
 	  This->lCurrentFrame = lPos;
 	  return This->lpInFormat;
 	}
@@ -278,7 +278,7 @@
     } /* for (lNext < lPos) */
   } /* if (This->lCurrentFrame != lPos) */
 
-  return (This->hic == (HIC)NULL ? This->lpInFormat : This->lpOutFormat);
+  return (This->hic == NULL ? This->lpInFormat : This->lpOutFormat);
 }
 
 static HRESULT WINAPI IGetFrame_fnBegin(IGetFrame *iface, LONG lStart,
@@ -396,7 +396,7 @@
   }
 
   /* need handle to video compressor */
-  if (This->hic == (HIC)NULL) {
+  if (This->hic == NULL) {
     FOURCC fccHandler;
 
     if (This->lpInFormat->biCompression == BI_RGB)
@@ -414,7 +414,7 @@
     }
 
     This->hic = ICLocate(ICTYPE_VIDEO, fccHandler, This->lpInFormat, lpbi, ICMODE_DECOMPRESS);
-    if (This->hic == (HIC)NULL) {
+    if (This->hic == NULL) {
       AVIFILE_CloseCompressor(This);
       return AVIERR_NOCOMPRESSOR;
     }
diff --git a/dlls/avifil32/icmstream.c b/dlls/avifil32/icmstream.c
index b109dab..7b73877 100644
--- a/dlls/avifil32/icmstream.c
+++ b/dlls/avifil32/icmstream.c
@@ -186,7 +186,7 @@
       IAVIStream_Release(This->pStream);
       This->pStream = NULL;
     }
-    if (This->hic != (HIC)NULL) {
+    if (This->hic != NULL) {
       if (This->lpbiPrev != NULL) {
 	ICDecompressEnd(This->hic);
 	GlobalFreePtr(This->lpbiPrev);
@@ -194,7 +194,7 @@
 	This->lpPrev   = NULL;
       }
       ICCompressEnd(This->hic);
-      This->hic = (HIC)NULL;
+      This->hic = NULL;
     }
     if (This->lpbiCur != NULL) {
       GlobalFreePtr(This->lpbiCur);
@@ -258,7 +258,7 @@
     This->sInfo.fccHandler = pco->fccHandler;
 
     This->hic = ICOpen(ICTYPE_VIDEO, pco->fccHandler, ICMODE_COMPRESS);
-    if (This->hic == (HIC)NULL)
+    if (This->hic == NULL)
       return AVIERR_NOCOMPRESSOR;
 
     /* restore saved state of codec */
@@ -352,7 +352,7 @@
     WARN(": FIND_RET flags will be ignored!\n");
 
   if (flags & FIND_KEY) {
-    if (This->hic == (HIC)NULL)
+    if (This->hic == NULL)
       return pos; /* we decompress so every frame is a keyframe */
 
     if (flags & FIND_PREV) {
@@ -396,7 +396,7 @@
   if (lpbi == NULL)
     return AVIERR_MEMORY;
 
-  if (This->hic == (HIC)NULL) {
+  if (This->hic == NULL) {
     LONG size = lpbi->biSize + lpbi->biClrUsed * sizeof(RGBQUAD);
 
     if (size > 0) {
@@ -471,7 +471,7 @@
   if (This->lpbiInput == NULL) {
     LONG size;
 
-    assert(This->hic != (HIC)NULL);
+    assert(This->hic != NULL);
 
     /* get memory for input format */
     This->lpbiInput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, formatsize);
@@ -610,7 +610,7 @@
   }
 
   /* compress or decompress? */
-  if (This->hic == (HIC)NULL) {
+  if (This->hic == NULL) {
     /* decompress */
     lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(This->pg, start);
     if (lpbi == NULL)
@@ -899,7 +899,7 @@
   if (This->sInfo.fccHandler == comptypeDIB)
     return AVIERR_OK;
 
-  assert(This->hic != (HIC)NULL);
+  assert(This->hic != NULL);
   assert(This->lpbiOutput == NULL);
 
   /* get input format */
diff --git a/dlls/avifil32/wavfile.c b/dlls/avifil32/wavfile.c
index a4bd33f..6730c5e 100644
--- a/dlls/avifil32/wavfile.c
+++ b/dlls/avifil32/wavfile.c
@@ -259,9 +259,9 @@
       LocalFree((HLOCAL)This->szFileName);
       This->szFileName = NULL;
     }
-    if (This->hmmio != (HMMIO)NULL) {
+    if (This->hmmio != NULL) {
       mmioClose(This->hmmio, 0);
-      This->hmmio = (HMMIO)NULL;
+      This->hmmio = NULL;
     }
 
     LocalFree((HLOCAL)This);
@@ -532,7 +532,7 @@
     return AVIERR_BADPARAM;
 
   assert(This != NULL);
-  if (This->hmmio != (HMMIO)NULL)
+  if (This->hmmio != NULL)
     return AVIERR_ERROR; /* No reuse of this object for another file! */
 
   /* remeber mode and name */
@@ -546,7 +546,7 @@
 
   /* try to open the file */
   This->hmmio = mmioOpenW(This->szFileName, NULL, MMIO_ALLOCBUF | dwMode);
-  if (This->hmmio == (HMMIO)NULL)
+  if (This->hmmio == NULL)
     return AVIERR_FILEOPEN;
 
   memset(& This->fInfo, 0, sizeof(This->fInfo));
@@ -1107,9 +1107,9 @@
     /* try to open an appropriate audio codec to figure out
      * data for fact-chunk */
     wfx.wFormatTag = WAVE_FORMAT_PCM;
-    if (acmFormatSuggest((HACMDRIVER)NULL, This->lpFormat, &wfx,
+    if (acmFormatSuggest(NULL, This->lpFormat, &wfx,
 			 sizeof(wfx), ACM_FORMATSUGGESTF_WFORMATTAG)) {
-      acmStreamOpen(&has, (HACMDRIVER)NULL, This->lpFormat, &wfx, NULL,
+      acmStreamOpen(&has, NULL, This->lpFormat, &wfx, NULL,
 		    0, 0, ACM_STREAMOPENF_NONREALTIME);
       acmStreamSize(has, This->ckData.cksize, &dwFactLength,
 		    ACM_STREAMSIZEF_SOURCE);
diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index cef888a..42cc46a 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -950,5 +950,5 @@
 
 void ANIMATE_Unregister(void)
 {
-    UnregisterClassA(ANIMATE_CLASSA, (HINSTANCE)NULL);
+    UnregisterClassA(ANIMATE_CLASSA, NULL);
 }
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index 883329c..00c769f 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -2285,5 +2285,5 @@
 
 void COMBOEX_Unregister (void)
 {
-    UnregisterClassW (WC_COMBOBOXEXW, (HINSTANCE)NULL);
+    UnregisterClassW (WC_COMBOBOXEXW, NULL);
 }
diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index e39bcd6..c279c4e 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -419,7 +419,7 @@
 	if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
 	    TRACE("control id 0x%x\n", *lpRun);
 	    GetWindowRect (hwndCtrl, &rcCtrl);
-	    MapWindowPoints ((HWND)0, hwnd, (LPPOINT)&rcCtrl, 2);
+	    MapWindowPoints (NULL, hwnd, (LPPOINT)&rcCtrl, 2);
 	    SubtractRect (lpRect, lpRect, &rcCtrl);
 	}
 	lpRun++;
@@ -881,7 +881,7 @@
     }
     nWidth  = (INT)lpBitmapInfo->biWidth;
     nHeight = (INT)lpBitmapInfo->biHeight;
-    hdcScreen = GetDC ((HWND)0);
+    hdcScreen = GetDC (NULL);
     hbm = CreateCompatibleBitmap (hdcScreen, nWidth, nHeight);
     if (hbm) {
 	HDC hdcDst = CreateCompatibleDC (hdcScreen);
@@ -894,7 +894,7 @@
 	SelectObject (hdcDst, hbmOld);
 	DeleteDC (hdcDst);
     }
-    ReleaseDC ((HWND)0, hdcScreen);
+    ReleaseDC (NULL, hdcScreen);
     GlobalFree ((HGLOBAL)lpBitmapInfo);
     FreeResource (hglb);
 
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 5464b9c..3311c7c 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -1103,7 +1103,7 @@
   /* use DrawEdge to adjust the size of rcEdge to get rcDraw */
   memcpy((&infoPtr->rcDraw), (&infoPtr->rcClient), sizeof(infoPtr->rcDraw));
 
-  DrawEdge((HDC)NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST);
+  DrawEdge(NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST);
 
   /* set the size of the button that drops the calendar down */
   /* FIXME: account for style that allows button on left side */
@@ -1316,5 +1316,5 @@
 DATETIME_Unregister (void)
 {
     TRACE("\n");
-    UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);
+    UnregisterClassA (DATETIMEPICK_CLASSA, NULL);
 }
diff --git a/dlls/comctl32/flatsb.c b/dlls/comctl32/flatsb.c
index ea275e3..a348a06 100644
--- a/dlls/comctl32/flatsb.c
+++ b/dlls/comctl32/flatsb.c
@@ -251,5 +251,5 @@
 VOID
 FLATSB_Unregister (void)
 {
-    UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL);
+    UnregisterClassA (FLATSB_CLASSA, NULL);
 }
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index afc8697..1f8987d 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -1799,5 +1799,5 @@
 VOID
 HEADER_Unregister (void)
 {
-    UnregisterClassA (WC_HEADERA, (HINSTANCE)NULL);
+    UnregisterClassA (WC_HEADERA, NULL);
 }
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c
index 1067579..5eb288c 100644
--- a/dlls/comctl32/hotkey.c
+++ b/dlls/comctl32/hotkey.c
@@ -365,7 +365,7 @@
     infoPtr->bFocus = TRUE;
 
 
-    CreateCaret (infoPtr->hwndSelf, (HBITMAP)0, 1, infoPtr->nHeight - 2);
+    CreateCaret (infoPtr->hwndSelf, NULL, 1, infoPtr->nHeight - 2);
 
     SetCaretPos (infoPtr->CaretPos, 3);
 
@@ -497,5 +497,5 @@
 void
 HOTKEY_Unregister (void)
 {
-    UnregisterClassW (HOTKEY_CLASSW, (HINSTANCE)NULL);
+    UnregisterClassW (HOTKEY_CLASSW, NULL);
 }
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index 752ea67..a03bea0 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -569,5 +569,5 @@
 
 void IPADDRESS_Unregister (void)
 {
-    UnregisterClassW (WC_IPADDRESSW, (HINSTANCE)NULL);
+    UnregisterClassW (WC_IPADDRESSW, NULL);
 }
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 93d7a45..31770b2 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -7011,7 +7011,7 @@
   /* create header */
   infoPtr->hwndHeader =	CreateWindowW(WC_HEADERW, (LPCWSTR)NULL,
     WS_CHILD | HDS_HORZ | (DWORD)((LVS_NOSORTHEADER & lpcs->style)?0:HDS_BUTTONS),
-    0, 0, 0, 0, hwnd, (HMENU)0,
+    0, 0, 0, 0, hwnd, NULL,
     lpcs->hInstance, NULL);
 
   /* set header unicode format */
@@ -8783,7 +8783,7 @@
  */
 void LISTVIEW_Unregister(void)
 {
-    UnregisterClassW(WC_LISTVIEWW, (HINSTANCE)NULL);
+    UnregisterClassW(WC_LISTVIEWW, NULL);
 }
 
 /***
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 579f6d7..e4d79e4 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -1451,8 +1451,8 @@
 			 infoPtr->titleyear.right-infoPtr->titleyear.left,
 			 infoPtr->textHeight,
 			 hwnd,
-			 (HMENU)NULL,
-			 (HINSTANCE)NULL,
+			 NULL,
+			 NULL,
 			 NULL);
     infoPtr->hWndYearUpDown=CreateWindowExA(0,
 			 UPDOWN_CLASSA,
@@ -1462,8 +1462,8 @@
 			 20,
 			 infoPtr->textHeight,
 			 hwnd,
-			 (HMENU)NULL,
-			 (HINSTANCE)NULL,
+			 NULL,
+			 NULL,
 			 NULL);
     SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753));
     SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 );
@@ -2062,5 +2062,5 @@
 void
 MONTHCAL_Unregister(void)
 {
-    UnregisterClassA(MONTHCAL_CLASSA, (HINSTANCE)NULL);
+    UnregisterClassA(MONTHCAL_CLASSA, NULL);
 }
diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c
index 2202adc..c95620b 100644
--- a/dlls/comctl32/nativefont.c
+++ b/dlls/comctl32/nativefont.c
@@ -131,6 +131,5 @@
 VOID
 NATIVEFONT_Unregister (void)
 {
-    UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
+    UnregisterClassA (WC_NATIVEFONTCTLA, NULL);
 }
-
diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c
index d29ffd3..d03c35b 100644
--- a/dlls/comctl32/pager.c
+++ b/dlls/comctl32/pager.c
@@ -836,7 +836,7 @@
     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
 
     /* set default settings */
-    infoPtr->hwndChild = (HWND)NULL;
+    infoPtr->hwndChild = NULL;
     infoPtr->bNoResize = dwStyle & CCS_NORESIZE;
     infoPtr->clrBk = GetSysColor(COLOR_BTNFACE);
     infoPtr->nBorder = 0;
@@ -1603,5 +1603,5 @@
 VOID
 PAGER_Unregister (void)
 {
-    UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);
+    UnregisterClassA (WC_PAGESCROLLERA, NULL);
 }
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index 2c50dda..74d9a98 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -430,5 +430,5 @@
  */
 VOID PROGRESS_Unregister (void)
 {
-    UnregisterClassW (PROGRESS_CLASSW, (HINSTANCE)NULL);
+    UnregisterClassW (PROGRESS_CLASSW, NULL);
 }
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 3cb98f0..91d630a 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -4509,5 +4509,5 @@
 VOID
 REBAR_Unregister (void)
 {
-    UnregisterClassA (REBARCLASSNAMEA, (HINSTANCE)NULL);
+    UnregisterClassA (REBARCLASSNAMEA, NULL);
 }
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index 182fccd..2b8c6d3 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -1280,5 +1280,5 @@
 void
 STATUS_Unregister (void)
 {
-    UnregisterClassW (STATUSCLASSNAMEW, (HINSTANCE)NULL);
+    UnregisterClassW (STATUSCLASSNAMEW, NULL);
 }
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 045cb2a..be68dcd 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -986,14 +986,14 @@
 					  controlPos.right - controlPos.left,
 					  controlPos.bottom - controlPos.top,
 					  hwnd,
-					  (HMENU)NULL,
-					  (HINSTANCE)NULL,
+					  NULL,
+					  NULL,
 					  NULL);
     }
     else
     {
       SetWindowPos(infoPtr->hwndUpDown,
-		   (HWND)NULL,
+		   NULL,
 		   controlPos.left, controlPos.top,
 		   controlPos.right - controlPos.left,
 		   controlPos.bottom - controlPos.top,
@@ -3196,7 +3196,7 @@
   wndClass.cbClsExtra    = 0;
   wndClass.cbWndExtra    = sizeof(TAB_INFO *);
   wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
-  wndClass.hbrBackground = (HBRUSH)NULL;
+  wndClass.hbrBackground = NULL;
   wndClass.lpszClassName = WC_TABCONTROLA;
 
   RegisterClassA (&wndClass);
@@ -3206,5 +3206,5 @@
 VOID
 TAB_Unregister (void)
 {
-    UnregisterClassA (WC_TABCONTROLA, (HINSTANCE)NULL);
+    UnregisterClassA (WC_TABCONTROLA, NULL);
 }
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index c0050a1..f789354 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -2225,7 +2225,7 @@
     nCount = ImageList_GetImageCount(himlDef);
 
     /* Add bitmaps to the default image list */
-    if (lpAddBmp->hInst == (HINSTANCE)0)
+    if (lpAddBmp->hInst == NULL)
     {
 	nIndex =
 	    ImageList_AddMasked (himlDef, (HBITMAP)lpAddBmp->nID,
@@ -5959,7 +5959,7 @@
 VOID
 TOOLBAR_Unregister (void)
 {
-    UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL);
+    UnregisterClassA (TOOLBARCLASSNAMEA, NULL);
 }
 
 static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl, INT id)
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 1be2548..dde7b41 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -324,7 +324,7 @@
 	    GetWindowRect ((HWND)toolPtr->uId, &rc);
 	else {
 	    rc = toolPtr->rect;
-	    MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2);
+	    MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
 	}
 	rect.left = (rc.left + rc.right - size.cx) / 2;
 	rect.top  = rc.bottom + 2;
@@ -353,7 +353,7 @@
 	    GetWindowRect ((HWND)toolPtr->uId, &rc);
 	else {
 	    rc = toolPtr->rect;
-	    MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2);
+	    MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
 	}
 	rect.bottom = rc.top - 2;
     	rect.top = rect.bottom - size.cy;
@@ -456,7 +456,7 @@
 	    GetWindowRect ((HWND)toolPtr->uId, &rcTool);
 	else {
 	    rcTool = toolPtr->rect;
-	    MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rcTool, 2);
+	    MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
 	}
 
 	GetCursorPos ((LPPOINT)&rect);
@@ -2444,5 +2444,5 @@
 VOID
 TOOLTIPS_Unregister (void)
 {
-    UnregisterClassA (TOOLTIPS_CLASSA, (HINSTANCE)NULL);
+    UnregisterClassA (TOOLTIPS_CLASSA, NULL);
 }
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 9dc4e3b..a15fdee 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -1737,5 +1737,5 @@
 
 void TRACKBAR_Unregister (void)
 {
-    UnregisterClassW (TRACKBAR_CLASSW, (HINSTANCE)NULL);
+    UnregisterClassW (TRACKBAR_CLASSW, NULL);
 }
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 448e553..c4e26e1 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3541,7 +3541,7 @@
 
     TRACE("%x %p\n", (unsigned)hwnd, hItem);
     if (!TREEVIEW_ValidItem(infoPtr, editItem))
-	return (HWND)NULL;
+	return NULL;
 
     if (infoPtr->hwndEdit)
 	return infoPtr->hwndEdit;
@@ -3608,7 +3608,7 @@
     {
 	DestroyWindow(hwndEdit);
 	infoPtr->hwndEdit = 0;
-	return (HWND)NULL;
+	return NULL;
     }
 
     infoPtr->selectedItem = hItem;
@@ -5412,7 +5412,7 @@
 VOID
 TREEVIEW_Unregister(void)
 {
-    UnregisterClassA(WC_TREEVIEWA, (HINSTANCE) NULL);
+    UnregisterClassA(WC_TREEVIEWA, NULL);
 }
 
 
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c
index 3cff9ac..1078e0c 100644
--- a/dlls/comctl32/updown.c
+++ b/dlls/comctl32/updown.c
@@ -966,5 +966,5 @@
  */
 void UPDOWN_Unregister (void)
 {
-    UnregisterClassW (UPDOWN_CLASSW, (HINSTANCE)NULL);
+    UnregisterClassW (UPDOWN_CLASSW, NULL);
 }
diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c
index 1ebdb70..aaee311 100644
--- a/dlls/commdlg/filedlg95.c
+++ b/dlls/commdlg/filedlg95.c
@@ -396,7 +396,7 @@
 
   /* Initialize the dialog property */
   fodInfos.DlgInfos.dwDlgProp = 0;
-  fodInfos.DlgInfos.hwndCustomDlg = (HWND)NULL;
+  fodInfos.DlgInfos.hwndCustomDlg = NULL;
 
   switch(iDlgType)
   {
@@ -551,7 +551,7 @@
     }
     else
     {
-      if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL) return;
+      if( (GetWindow(hwndChildDlg,GW_CHILD)) == NULL) return;
 
       SetRectEmpty(&rectTemp);
       ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
@@ -608,7 +608,7 @@
 				rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
 				SWP_NOSIZE | SWP_NOZORDER );
         }
-      } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
+      } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != NULL);
     }
     hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
 
@@ -636,7 +636,7 @@
                 rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
                 SWP_NOSIZE |SWP_NOZORDER );
           }
-        } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
+        } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != NULL);
       }
     }
 }
@@ -699,7 +699,7 @@
         if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
         {
           COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
-          return (HWND)NULL;
+          return NULL;
         }
       }
       else
@@ -718,13 +718,13 @@
         if (!hRes)
         {
           COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
-          return (HWND)NULL;
+          return NULL;
         }
         if (!(hDlgTmpl = LoadResource( hinst, hRes )) ||
             !(template = LockResource( hDlgTmpl )))
         {
           COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
-          return (HWND)NULL;
+          return NULL;
     	}
       }
 
@@ -756,7 +756,7 @@
                   hwnd, FileOpenDlgProcUserTemplate, (LPARAM)fodInfos);
       return hChildDlg;
     }
-    return (HWND)NULL;
+    return NULL;
 }
 
 /***********************************************************************
diff --git a/dlls/ddraw/dsurface/dib.c b/dlls/ddraw/dsurface/dib.c
index 6eec516..983af93 100644
--- a/dlls/ddraw/dsurface/dib.c
+++ b/dlls/ddraw/dsurface/dib.c
@@ -218,7 +218,7 @@
 
     This->get_dc     = DIB_DirectDrawSurface_get_dc;
     This->release_dc = DIB_DirectDrawSurface_release_dc;
-    This->hDC = (HDC)NULL;
+    This->hDC = NULL;
 
     This->set_palette    = DIB_DirectDrawSurface_set_palette;
     This->update_palette = DIB_DirectDrawSurface_update_palette;
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 9b91a70..275f1a6 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -35,7 +35,7 @@
 {
   FIXME("(%p, %p): stub\n",hWnd,hIMC);
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HIMC)NULL;
+  return NULL;
 }
 
 /***********************************************************************
@@ -71,7 +71,7 @@
 {
   FIXME("(): stub\n");
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HIMC)NULL;
+  return NULL;
 }
 
 /***********************************************************************
@@ -291,7 +291,7 @@
 {
   FIXME("(%p): stub\n", hWnd);
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HIMC)NULL;
+  return NULL;
 }
 
 /***********************************************************************
@@ -344,7 +344,7 @@
 {
   FIXME("(%p): stub\n", hWnd);
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HWND)NULL;
+  return NULL;
 }
 
 /***********************************************************************
@@ -506,7 +506,7 @@
     debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText)
   );
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HKL)NULL;
+  return NULL;
 }
 
 /***********************************************************************
@@ -519,7 +519,7 @@
     debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText)
   );
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return (HKL)NULL;
+  return NULL;
 }
 
 /***********************************************************************
diff --git a/dlls/kernel/tests/alloc.c b/dlls/kernel/tests/alloc.c
index 506dace..9c41c0c 100644
--- a/dlls/kernel/tests/alloc.c
+++ b/dlls/kernel/tests/alloc.c
@@ -195,14 +195,14 @@
     SetLastError(NO_ERROR);
 /* Check that a normal alloc works */
     mem1=GlobalAlloc((UINT)NULL,memchunk);
-    ok(mem1!=(HGLOBAL)NULL,"GlobalAlloc failed");
+    ok(mem1!=NULL,"GlobalAlloc failed");
     if(mem1) {
       ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block");
     }
 
 /* Check that a 'zeroing' alloc works */
     mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk);
-    ok(mem2!=(HGLOBAL)NULL,"GlobalAlloc failed");
+    ok(mem2!=NULL,"GlobalAlloc failed");
     if(mem2) {
       ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block");
       mem2ptr=(UCHAR *)GlobalLock(mem2);
@@ -220,8 +220,8 @@
 /* Check that GlobalReAlloc works */
 /* Check that we can change GMEM_FIXED to GMEM_MOVEABLE */
     mem2a=GlobalReAlloc(mem2,0,GMEM_MODIFY | GMEM_MOVEABLE);
-    ok(mem2a!=(HGLOBAL)NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE");
-    if(mem2a!=(HGLOBAL)NULL) {
+    ok(mem2a!=NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE");
+    if(mem2a!=NULL) {
       mem2=mem2a;
     }
     mem2ptr=GlobalLock(mem2a);
@@ -230,7 +230,7 @@
 
 /* Check that ReAllocing memory works as expected */
     mem2a=GlobalReAlloc(mem2,2*memchunk,GMEM_MOVEABLE | GMEM_ZEROINIT);
-    ok(mem2a!=(HGLOBAL)NULL,"GlobalReAlloc failed");
+    ok(mem2a!=NULL,"GlobalReAlloc failed");
     if(mem2a) {
       ok(GlobalSize(mem2a)>=2*memchunk,"GlobalReAlloc failed");
       mem2ptr=(UCHAR *)GlobalLock(mem2a);
@@ -252,22 +252,22 @@
 #if DISCARD_DEFINED
         /* Wine doesn't include the GlobalDiscard function */
         mem2b=GlobalDiscard(mem2a);
-        ok(mem2b==(HGLOBAL)NULL,"Discarded memory we shouldn't have");
+        ok(mem2b==NULL,"Discarded memory we shouldn't have");
 #else
         /* This is functionally equivalent to the above */
         mem2b=GlobalReAlloc(mem2a,0,GMEM_MOVEABLE);
-        ok(mem2b==(HGLOBAL)NULL,"Discarded memory we shouldn't have");
+        ok(mem2b==NULL,"Discarded memory we shouldn't have");
 #endif
         ok(!GlobalUnlock(mem2a) && GetLastError()==NO_ERROR,"GlobalUnlock Failed.");
       }
     }
     if(mem1) {
-      ok(GlobalFree(mem1)==(HGLOBAL)NULL,"GlobalFree failed");
+      ok(GlobalFree(mem1)==NULL,"GlobalFree failed");
     }
     if(mem2a) {
-      ok(GlobalFree(mem2a)==(HGLOBAL)NULL,"GlobalFree failed");
+      ok(GlobalFree(mem2a)==NULL,"GlobalFree failed");
     } else {
-      ok(GlobalFree(mem2)==(HGLOBAL)NULL,"GlobalFree failed");
+      ok(GlobalFree(mem2)==NULL,"GlobalFree failed");
     }
 }
 
@@ -293,14 +293,14 @@
 
 /* Check that a normal alloc works */
     mem1=LocalAlloc((UINT)NULL,memchunk);
-    ok(mem1!=(HLOCAL)NULL,"LocalAlloc failed");
+    ok(mem1!=NULL,"LocalAlloc failed");
     if(mem1) {
       ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block");
     }
 
 /* Check that a 'zeroing' alloc works */
     mem2=LocalAlloc(LMEM_ZEROINIT,memchunk);
-    ok(mem2!=(HLOCAL)NULL,"LocalAlloc failed");
+    ok(mem2!=NULL,"LocalAlloc failed");
     if(mem2) {
       ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block");
       mem2ptr=(UCHAR *)LocalLock(mem2);
@@ -322,11 +322,11 @@
 /* Reallocate mem2 as moveable memory */
    mem2a=LocalFree(mem2);
    mem2=LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,memchunk);
-   ok(mem2a==(HLOCAL)NULL && mem2!=(HLOCAL)NULL, "LocalAlloc failed to create moveable memory");
+   ok(mem2a==NULL && mem2!=NULL, "LocalAlloc failed to create moveable memory");
 
 /* Check that ReAllocing memory works as expected */
     mem2a=LocalReAlloc(mem2,2*memchunk,LMEM_MOVEABLE | LMEM_ZEROINIT);
-    ok(mem2a!=(HLOCAL)NULL,"LocalReAlloc failed");
+    ok(mem2a!=NULL,"LocalReAlloc failed");
     if(mem2a) {
       ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed");
       mem2ptr=(UCHAR *)LocalLock(mem2a);
@@ -346,23 +346,23 @@
 #if DISCARD_DEFINED
         /* Wine doesn't include the LocalDiscard function */
         mem2b=LocalDiscard(mem2a);
-        ok(mem2b==(HLOCAL)NULL,"Discarded memory we shouldn't have");
+        ok(mem2b==NULL,"Discarded memory we shouldn't have");
 #else
         /* This is functionally equivalent to the above */
         mem2b=LocalReAlloc(mem2a,0,GMEM_MOVEABLE);
-        ok(mem2b==(HLOCAL)NULL,"Discarded memory we shouldn't have");
+        ok(mem2b==NULL,"Discarded memory we shouldn't have");
 #endif
         SetLastError(NO_ERROR);
         ok(!LocalUnlock(mem2a) && GetLastError()==NO_ERROR, "LocalUnlock Failed.");
       }
     }
     if(mem1) {
-      ok(LocalFree(mem1)==(HLOCAL)NULL,"LocalFree failed");
+      ok(LocalFree(mem1)==NULL,"LocalFree failed");
     }
     if(mem2a) {
-      ok(LocalFree(mem2a)==(HLOCAL)NULL,"LocalFree failed");
+      ok(LocalFree(mem2a)==NULL,"LocalFree failed");
     } else {
-      ok(LocalFree(mem2)==(HLOCAL)NULL,"LocalFree failed");
+      ok(LocalFree(mem2)==NULL,"LocalFree failed");
     }
 }
 
diff --git a/dlls/msacm/filter.c b/dlls/msacm/filter.c
index 6be5586..6389125 100644
--- a/dlls/msacm/filter.c
+++ b/dlls/msacm/filter.c
@@ -100,7 +100,7 @@
 	    mmr = MMSYSERR_INVALPARAM;
 	    break;
 	}
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    PWINE_ACMDRIVERID		padid;
 
 	    mmr = ACMERR_NOTPOSSIBLE;
@@ -298,7 +298,7 @@
 
     switch (fdwDetails) {
     case ACM_FILTERTAGDETAILSF_FILTERTAG:
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    mmr = ACMERR_NOTPOSSIBLE;
 	    for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
 		/* should check for codec only */
@@ -320,7 +320,7 @@
 	break;
 
     case ACM_FILTERTAGDETAILSF_LARGESTSIZE:
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    ACMFILTERTAGDETAILSW	tmp;
 	    DWORD			ft = paftd->dwFilterTag;
 
diff --git a/dlls/msacm/format.c b/dlls/msacm/format.c
index a608d50..dd3b769 100644
--- a/dlls/msacm/format.c
+++ b/dlls/msacm/format.c
@@ -143,7 +143,7 @@
     affd.hWnd = hWnd;
     affd.mode = WINE_ACMFF_TAG;
 
-    acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
+    acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
     SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0);
     return TRUE;
 }
@@ -166,7 +166,7 @@
 					    CB_GETCURSEL, 0, 0),
 			(DWORD)affd.szFormatTag);
 
-    acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
+    acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
     SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0);
     return TRUE;
 }
@@ -189,7 +189,7 @@
 					    CB_GETCURSEL, 0, 0),
 			(DWORD)affd.szFormatTag);
 
-    acmFormatTagEnumA((HACMDRIVER)0, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
+    acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
     return affd.ret;
 }
 
@@ -332,7 +332,7 @@
 	    mmr = MMSYSERR_INVALPARAM;
 	    break;
 	}
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    PWINE_ACMDRIVERID		padid;
 
 	    mmr = ACMERR_NOTPOSSIBLE;
@@ -552,7 +552,7 @@
     adfg.pwfxDst = pwfxDst;
     adfg.cbwfxDst = cbwfxDst;
 
-    if (had == (HACMDRIVER)NULL) {
+    if (had == NULL) {
 	PWINE_ACMDRIVERID	padid;
 
 	/* MS doc says: ACM finds the best suggestion.
@@ -621,7 +621,7 @@
 
     switch (fdwDetails) {
     case ACM_FORMATTAGDETAILSF_FORMATTAG:
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
 		/* should check for codec only */
 		if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
@@ -641,7 +641,7 @@
 	break;
 
     case ACM_FORMATTAGDETAILSF_INDEX:
-	if (had != (HACMDRIVER)NULL) {
+	if (had != NULL) {
 	    PWINE_ACMDRIVER	pad = MSACM_GetDriver(had);
 
 	    if (pad && paftd->dwFormatTagIndex < pad->obj.pACMDriverID->cFormatTags)
@@ -650,7 +650,7 @@
 	break;
 
     case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
-	if (had == (HACMDRIVER)NULL) {
+	if (had == NULL) {
 	    ACMFORMATTAGDETAILSW	tmp;
 	    DWORD			ft = paftd->dwFormatTag;
 
diff --git a/dlls/msacm/imaadp32/imaadp32.c b/dlls/msacm/imaadp32/imaadp32.c
index 2592d1c..a8117ff 100644
--- a/dlls/msacm/imaadp32/imaadp32.c
+++ b/dlls/msacm/imaadp32/imaadp32.c
@@ -476,7 +476,7 @@
     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
     add->cFormatTags = 2; /* PCM, IMA ADPCM */
     add->cFilterTags = 0;
-    add->hicon = (HICON)0;
+    add->hicon = NULL;
     MultiByteToWideChar( CP_ACP, 0, "WINE-ADPCM", -1,
                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, "Wine IMA ADPCM converter", -1,
diff --git a/dlls/msacm/msacm32_main.c b/dlls/msacm/msacm32_main.c
index 327b709..6b7b39b 100644
--- a/dlls/msacm/msacm32_main.c
+++ b/dlls/msacm/msacm32_main.c
@@ -52,7 +52,7 @@
         MSACM_UnregisterAllDrivers();
         HeapDestroy(MSACM_hHeap);
         MSACM_hHeap = (HANDLE)NULL;
-        MSACM_hInstance32 = (HINSTANCE)NULL;
+        MSACM_hInstance32 = NULL;
 	break;
     case DLL_THREAD_ATTACH:
 	break;
@@ -176,7 +176,7 @@
 	break;
 
     case ACM_METRIC_MAX_SIZE_FORMAT:
-	if (hao == (HACMOBJ)NULL) {
+	if (hao == NULL) {
 	    for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
 		if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
 		    for (i = 0; i < padid->cFormatTags; i++) {
diff --git a/dlls/msacm/msadp32/msadp32.c b/dlls/msacm/msadp32/msadp32.c
index ce5d32b..a7a8c63 100644
--- a/dlls/msacm/msadp32/msadp32.c
+++ b/dlls/msacm/msadp32/msadp32.c
@@ -322,7 +322,7 @@
     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
     add->cFormatTags = 2; /* PCM, MS ADPCM */
     add->cFilterTags = 0;
-    add->hicon = (HICON)0;
+    add->hicon = NULL;
     MultiByteToWideChar( CP_ACP, 0, "WINE-MS ADPCM", -1,
                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, "Wine MS ADPCM converter", -1,
diff --git a/dlls/msacm/msg711/msg711.c b/dlls/msacm/msg711/msg711.c
index 637eeb9..18023ad 100644
--- a/dlls/msacm/msg711/msg711.c
+++ b/dlls/msacm/msg711/msg711.c
@@ -659,7 +659,7 @@
     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
     add->cFormatTags = 3; /* PCM, G711 A-LAW & MU-LAW */
     add->cFilterTags = 0;
-    add->hicon = (HICON)0;
+    add->hicon = NULL;
     MultiByteToWideChar( CP_ACP, 0, "WINE-G711", -1,
                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, "Wine G711 converter", -1,
diff --git a/dlls/msacm/pcmconverter.c b/dlls/msacm/pcmconverter.c
index 891995f..3ff5466 100644
--- a/dlls/msacm/pcmconverter.c
+++ b/dlls/msacm/pcmconverter.c
@@ -719,7 +719,7 @@
     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CONVERTER;
     add->cFormatTags = 1;
     add->cFilterTags = 0;
-    add->hicon = (HICON)0;
+    add->hicon = NULL;
     MultiByteToWideChar( CP_ACP, 0, "WINE-PCM", -1,
                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, "Wine PCM converter", -1,
diff --git a/dlls/msacm/stream.c b/dlls/msacm/stream.c
index 8e4c28e..498aa47 100644
--- a/dlls/msacm/stream.c
+++ b/dlls/msacm/stream.c
@@ -237,7 +237,7 @@
     }
 errCleanUp:
     if (phas)
-	*phas = (HACMSTREAM)0;
+	*phas = NULL;
     HeapFree(MSACM_hHeap, 0, was);
     TRACE("=> (%d)\n", ret);
     return ret;
diff --git a/dlls/msacm/winemp3/mpegl3.c b/dlls/msacm/winemp3/mpegl3.c
index e475455..c0221f6 100644
--- a/dlls/msacm/winemp3/mpegl3.c
+++ b/dlls/msacm/winemp3/mpegl3.c
@@ -177,7 +177,7 @@
     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
     add->cFormatTags = 2; /* PCM, MPEG3 */
     add->cFilterTags = 0;
-    add->hicon = (HICON)0;
+    add->hicon = NULL;
     MultiByteToWideChar( CP_ACP, 0, "WINE-MPEG3", -1,
                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
     MultiByteToWideChar( CP_ACP, 0, "Wine MPEG3 decoder", -1,
diff --git a/dlls/msvideo/mciwnd.c b/dlls/msvideo/mciwnd.c
index 9fcc4fb..fded324 100644
--- a/dlls/msvideo/mciwnd.c
+++ b/dlls/msvideo/mciwnd.c
@@ -101,7 +101,7 @@
    if (CreateWindowExA(0, "MCIWndClass", NULL, wndStyle,
 		       CW_USEDEFAULT, CW_USEDEFAULT,
 		       CW_USEDEFAULT, CW_USEDEFAULT,
-		       hwndParent, (HMENU)0, hInstance, mwi))
+		       hwndParent, NULL, hInstance, mwi))
       return mwi->hWnd;
 
    if(mwi->lpName) HeapFree(GetProcessHeap(), 0, mwi->lpName);
diff --git a/dlls/msvideo/msvideo_main.c b/dlls/msvideo/msvideo_main.c
index 75c2e5f..55406c4 100644
--- a/dlls/msvideo/msvideo_main.c
+++ b/dlls/msvideo/msvideo_main.c
@@ -698,7 +698,7 @@
 	HIC hic, UINT uiFlags, LPBITMAPINFO lpbiIn,
 	LPVOID lpBits, LPBITMAPINFO lpbiOut)
 {
-	HGLOBAL	hMem = (HGLOBAL)NULL;
+	HGLOBAL	hMem = NULL;
 	BYTE*	pMem = NULL;
 	BOOL	bReleaseIC = FALSE;
 	BYTE*	pHdr = NULL;
@@ -710,10 +710,10 @@
 	TRACE("(%p,%08x,%p,%p,%p)\n",
 		hic, uiFlags, lpbiIn, lpBits, lpbiOut);
 
-	if ( hic == (HIC)NULL )
+	if ( hic == NULL )
 	{
 		hic = ICDecompressOpen( mmioFOURCC('V','I','D','C'), 0, &lpbiIn->bmiHeader, (lpbiOut != NULL) ? &lpbiOut->bmiHeader : NULL );
-		if ( hic == (HIC)NULL )
+		if ( hic == NULL )
 		{
 			WARN("no handler\n" );
 			goto err;
@@ -791,7 +791,7 @@
 	TRACE( "cbHdr %ld, biSizeImage %ld\n", cbHdr, biSizeImage );
 
 	hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_ZEROINIT, cbHdr + biSizeImage );
-	if ( hMem == (HGLOBAL)NULL )
+	if ( hMem == NULL )
 	{
 		WARN( "out of memory\n" );
 		goto err;
@@ -815,9 +815,9 @@
 		HeapFree(GetProcessHeap(),0,pHdr);
 	if ( pMem != NULL )
 		GlobalUnlock( hMem );
-	if ( !bSucceeded && hMem != (HGLOBAL)NULL )
+	if ( !bSucceeded && hMem != NULL )
 	{
-		GlobalFree(hMem); hMem = (HGLOBAL)NULL;
+		GlobalFree(hMem); hMem = NULL;
 	}
 
 	return (HANDLE)hMem;
diff --git a/dlls/ole32/ole2stubs.c b/dlls/ole32/ole2stubs.c
index 6bc0312..b02761f 100644
--- a/dlls/ole32/ole2stubs.c
+++ b/dlls/ole32/ole2stubs.c
@@ -153,7 +153,7 @@
 HGLOBAL WINAPI OleGetIconOfClass(REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel)
 {
   FIXME("(%p,%p,%x), stub!\n", rclsid, lpszLabel, fUseTypeAsLabel);
-  return (HGLOBAL)NULL;
+  return NULL;
 }
 
 /******************************************************************************
diff --git a/dlls/richedit/richedit.c b/dlls/richedit/richedit.c
index d73ad89..8232007 100644
--- a/dlls/richedit/richedit.c
+++ b/dlls/richedit/richedit.c
@@ -796,7 +796,7 @@
 {
     TRACE("\n");
 
-    UnregisterClassA(RICHEDIT_CLASS10A, (HINSTANCE)NULL);
+    UnregisterClassA(RICHEDIT_CLASS10A, NULL);
 }
 
 INT RICHEDIT_GetTextRange(HWND hwnd,TEXTRANGEA *tr)
diff --git a/dlls/setupapi/virtcopy.c b/dlls/setupapi/virtcopy.c
index dd91bec..dd75754 100644
--- a/dlls/setupapi/virtcopy.c
+++ b/dlls/setupapi/virtcopy.c
@@ -637,7 +637,7 @@
     wndClass.cbClsExtra    = 0;
     wndClass.cbWndExtra    = 0;
     wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
-    wndClass.hbrBackground = (HBRUSH)NULL;
+    wndClass.hbrBackground = NULL;
     wndClass.lpszClassName = "setupx_progress";
 
     RegisterClassA (&wndClass);
diff --git a/dlls/shell32/control.c b/dlls/shell32/control.c
index 39262a8..72ef303 100644
--- a/dlls/shell32/control.c
+++ b/dlls/shell32/control.c
@@ -275,7 +275,7 @@
 		    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
 		    CW_USEDEFAULT, CW_USEDEFAULT,
 		    CW_USEDEFAULT, CW_USEDEFAULT,
-		    hWnd, (HMENU)0, hInst, panel);
+		    hWnd, NULL, hInst, panel);
     if (!panel->hWnd) return;
     while (GetMessageA(&msg, panel->hWnd, 0, 0)) {
         TranslateMessage(&msg);
diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c
index e937f36..e16c7d3 100644
--- a/dlls/shell32/dialogs.c
+++ b/dlls/shell32/dialogs.c
@@ -122,7 +122,7 @@
             prfdp = (RUNFILEDLGPARAMS *)lParam ;
             SetWindowTextA (hwnd, prfdp->lpstrTitle) ;
             SetClassLongA (hwnd, GCL_HICON, (LPARAM)prfdp->hIcon) ;
-            SendMessageA (GetDlgItem (hwnd, 12297), STM_SETICON, (WPARAM)LoadIconA ((HINSTANCE)NULL, IDI_WINLOGOA), 0) ;
+            SendMessageA (GetDlgItem (hwnd, 12297), STM_SETICON, (WPARAM)LoadIconA (NULL, IDI_WINLOGOA), 0) ;
             FillList (GetDlgItem (hwnd, 12298), NULL) ;
             SetFocus (GetDlgItem (hwnd, 12298)) ;
             return TRUE ;
@@ -151,7 +151,7 @@
                 {
                 case IDOK :
                     {
-                    HWND htxt = (HWND)NULL ;
+                    HWND htxt = NULL ;
                     if ((ic = GetWindowTextLengthA (htxt = GetDlgItem (hwnd, 12298))))
                         {
                         psz = malloc (ic + 2) ;
@@ -195,8 +195,8 @@
                     static OPENFILENAMEA ofn =
                         {
                         sizeof (OPENFILENAMEA),
-                        (HWND)NULL,
-                        (HINSTANCE)NULL,
+                        NULL,
+                        NULL,
                         "Executable Files\0*.exe\0All Files\0*.*\0\0\0\0",
                         (LPSTR)NULL,
                         0,
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index c61992c..291d971 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -329,7 +329,7 @@
                                 HSZ hsz1, HSZ hsz2,
                                 HDDEDATA hData, DWORD dwData1, DWORD dwData2)
 {
-    return (HDDEDATA)0;
+    return NULL;
 }
 
 /******************************************************************
diff --git a/dlls/shlwapi/assoc.c b/dlls/shlwapi/assoc.c
index d9abe9c..60a8fc4 100644
--- a/dlls/shlwapi/assoc.c
+++ b/dlls/shlwapi/assoc.c
@@ -137,7 +137,7 @@
     return E_OUTOFMEMORY;
 
   flags &= SHLWAPI_DEF_ASSOCF;
-  hRet = IQueryAssociations_Init(lpAssoc, flags, pszAssoc, (HKEY)0, (HWND)0);
+  hRet = IQueryAssociations_Init(lpAssoc, flags, pszAssoc, NULL, NULL);
 
   if (SUCCEEDED(hRet))
     hRet = IQueryAssociations_GetKey(lpAssoc, flags, key, pszExtra, phkeyOut);
@@ -204,7 +204,7 @@
     return E_OUTOFMEMORY;
 
   hRet = IQueryAssociations_Init(lpAssoc, flags & SHLWAPI_DEF_ASSOCF,
-                                 pszAssoc, (HKEY)0, (HWND)0);
+                                 pszAssoc, NULL, NULL);
 
   if (SUCCEEDED(hRet))
     hRet = IQueryAssociations_GetString(lpAssoc, flags, str, pszExtra,
@@ -291,7 +291,7 @@
     return E_OUTOFMEMORY;
 
   flags &= SHLWAPI_DEF_ASSOCF;
-  hRet = IQueryAssociations_Init(lpAssoc, flags, 0, hkAssoc, (HWND)0);
+  hRet = IQueryAssociations_Init(lpAssoc, flags, 0, hkAssoc, NULL);
 
   if (SUCCEEDED(hRet))
     hRet = IQueryAssociations_GetString(lpAssoc, flags, str, pszExtra,
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 95c306e..e2217cd 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -2220,7 +2220,7 @@
 HICON WINAPI SHLWAPI_337(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge,
                          HICON *phiconSmall, UINT nIcons)
 {
-  GET_FUNC(pExtractIconExW, shell32, "ExtractIconExW", (HICON)0);
+  GET_FUNC(pExtractIconExW, shell32, "ExtractIconExW", NULL);
   return pExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
 }
 
@@ -2336,7 +2336,7 @@
 HICON WINAPI SHLWAPI_370(HINSTANCE hInstance, LPCWSTR lpszExeFileName,
                          UINT nIconIndex)
 {
-  GET_FUNC(pExtractIconW, shell32, "ExtractIconW", (HICON)0);
+  GET_FUNC(pExtractIconW, shell32, "ExtractIconW", NULL);
   return pExtractIconW(hInstance, lpszExeFileName, nIconIndex);
 }
 
diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c
index 68a7b17..d7c76cb 100644
--- a/dlls/shlwapi/reg.c
+++ b/dlls/shlwapi/reg.c
@@ -142,7 +142,7 @@
     if ((ret1 != ERROR_SUCCESS) && (ret2 != ERROR_SUCCESS)) {
 	HeapFree(GetProcessHeap(), 0, ihky);
 	if (phNewUSKey)
-	    *phNewUSKey = (HUSKEY)0;
+	    *phNewUSKey = NULL;
 	return ret2;
     }
 
@@ -208,7 +208,7 @@
     if ((ret1 != ERROR_SUCCESS) && (ret2 != ERROR_SUCCESS)) {
 	HeapFree(GetProcessHeap(), 0, ihky);
 	if (phNewUSKey)
-	    *phNewUSKey = (HUSKEY)0;
+	    *phNewUSKey = NULL;
 	return ret2;
     }
 
diff --git a/dlls/shlwapi/regstream.c b/dlls/shlwapi/regstream.c
index 3f53744..95113fb 100644
--- a/dlls/shlwapi/regstream.c
+++ b/dlls/shlwapi/regstream.c
@@ -325,7 +325,7 @@
 {
  &DummyRegStreamVTable,
  1,
- (HKEY)0,
+ NULL,
  NULL,
  0,
  0
@@ -373,7 +373,7 @@
 IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey,
                                    LPCSTR pszValue,DWORD dwMode)
 {
-  HKEY hStrKey = (HKEY)0;
+  HKEY hStrKey = NULL;
   LPBYTE lpBuff = NULL;
   DWORD dwLength, dwType;
 
@@ -402,7 +402,7 @@
 IStream * WINAPI SHOpenRegStream2W(HKEY hKey, LPCWSTR pszSubkey,
                                    LPCWSTR pszValue, DWORD dwMode)
 {
-  HKEY hStrKey = (HKEY)0;
+  HKEY hStrKey = NULL;
   LPBYTE lpBuff = NULL;
   DWORD dwLength, dwType;
 
@@ -497,7 +497,7 @@
     if (lpbDup)
     {
       memcpy(lpbDup, lpbData, dwDataLen);
-      iStrmRet = IStream_Create((HKEY)0, lpbDup, dwDataLen);
+      iStrmRet = IStream_Create(NULL, lpbDup, dwDataLen);
 
       if (!iStrmRet)
         HeapFree(GetProcessHeap(), 0, lpbDup);
@@ -536,7 +536,7 @@
   if(dwReserved || !lppStream)
     return E_INVALIDARG;
 
-  lpStream = IStream_Create((HKEY)0, lpbData, dwDataLen);
+  lpStream = IStream_Create(NULL, lpbData, dwDataLen);
 
   if(!lpStream)
     return E_OUTOFMEMORY;
diff --git a/dlls/shlwapi/tests/shreg.c b/dlls/shlwapi/tests/shreg.c
index 829c848..c74b40a 100644
--- a/dlls/shlwapi/tests/shreg.c
+++ b/dlls/shlwapi/tests/shreg.c
@@ -228,21 +228,21 @@
 	HKEY hKeySrc, hKeyDst;
 
 	/* Delete existing destination sub keys */
-	hKeyDst = (HKEY)0;
+	hKeyDst = NULL;
 	if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) && hKeyDst)
 	{
 		SHDeleteKeyA(hKeyDst, NULL);
 		RegCloseKey(hKeyDst);
 	}
 
-	hKeyDst = (HKEY)0;
+	hKeyDst = NULL;
 	if (RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) || !hKeyDst)
 	{
 		ok(0, "didn't open dest");
 		return;
 	}
 
-	hKeySrc = (HKEY)0;
+	hKeySrc = NULL;
 	if (RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc) || !hKeySrc)
 	{
 		ok(0, "didn't open source");
@@ -257,7 +257,7 @@
 	RegCloseKey(hKeyDst);
 
 	/* Check we copied the sub keys, i.e. AeDebug from the default wine registry */
-	hKeyDst = (HKEY)0;
+	hKeyDst = NULL;
 	if (RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\AeDebug", &hKeyDst) || !hKeyDst)
 	{
 		ok(0, "didn't open copy");
diff --git a/dlls/ttydrv/bitmap.c b/dlls/ttydrv/bitmap.c
index 2bb51f0..8936629 100644
--- a/dlls/ttydrv/bitmap.c
+++ b/dlls/ttydrv/bitmap.c
@@ -59,7 +59,7 @@
   FIXME("(%p, %p, %u, %p, %p, %ld): stub\n",
 	physDev->hdc, bmi, usage, bits, section, offset);
 
-  return (HBITMAP) NULL;
+  return NULL;
 }
 
 /***********************************************************************
diff --git a/dlls/ttydrv/wnd.c b/dlls/ttydrv/wnd.c
index 8a5a8ee..2c23871 100644
--- a/dlls/ttydrv/wnd.c
+++ b/dlls/ttydrv/wnd.c
@@ -734,7 +734,7 @@
 	     * window is already the topmost window, it will not
 	     * activate it.
 	     */
-	    if (GetTopWindow((HWND)0)==hwnd && (wasVisible || GetActiveWindow() == hwnd))
+	    if (GetTopWindow(NULL)==hwnd && (wasVisible || GetActiveWindow() == hwnd))
 	      swp |= SWP_NOACTIVATE;
 
 	    break;
diff --git a/dlls/user/dde/client.c b/dlls/user/dde/client.c
index 7c7227c..143ed82 100644
--- a/dlls/user/dde/client.c
+++ b/dlls/user/dde/client.c
@@ -394,7 +394,7 @@
     {
 	TRACE("Returning FALSE on XTYP_ADVSTART - fAck was FALSE\n");
 	GlobalFree(pXAct->hMem);
-        pXAct->hDdeData = (HDDEDATA)0;
+        pXAct->hDdeData = NULL;
     }
 
     return WDML_QS_HANDLED;
@@ -461,7 +461,7 @@
     if (!ddeAck.fAck)
     {
 	TRACE("Returning FALSE on XTYP_ADVSTOP - fAck was FALSE\n");
-        pXAct->hDdeData = (HDDEDATA)0;
+        pXAct->hDdeData = NULL;
     }
     else
     {
diff --git a/dlls/user/dde/misc.c b/dlls/user/dde/misc.c
index 756dd4e..784a025 100644
--- a/dlls/user/dde/misc.c
+++ b/dlls/user/dde/misc.c
@@ -715,7 +715,7 @@
     HDDEDATA	ret;
 
     if (pInstance == NULL)
-	return (HDDEDATA)0;
+	return NULL;
     TRACE("invoking CB%d[%p] (%u %u %p %p %p %p %lu %lu)\n",
 	  pInstance->win16 ? 16 : 32, pInstance->callback, uType, uFmt,
 	  hConv, hsz1, hsz2, hdata, dwData1, dwData2);
@@ -857,7 +857,7 @@
 {
     WCHAR nameBuffer[MAX_BUFFER_LEN];
 
-    if (!atom) return (HSZ)0;
+    if (!atom) return NULL;
 
     if (GlobalGetAtomNameW(atom, nameBuffer, MAX_BUFFER_LEN))
     {
diff --git a/dlls/user/dde/server.c b/dlls/user/dde/server.c
index 3809e73..ef432c9 100644
--- a/dlls/user/dde/server.c
+++ b/dlls/user/dde/server.c
@@ -174,7 +174,7 @@
     HWND 		hwndServer;
     WNDCLASSEXA  	wndclass;
 
-    hDdeData = (HDDEDATA)NULL;
+    hDdeData = NULL;
 
     TRACE("(%ld,%p,%p,%d)\n", idInst, hsz1, hsz2, afCmd);
 
@@ -706,7 +706,7 @@
 {
     WDML_LINK*	pLink;
 
-    if (pXAct->hszItem == (HSZ)0 || pXAct->wFmt == 0)
+    if (pXAct->hszItem == NULL || pXAct->wFmt == 0)
     {
 	ERR("Unsupported yet options (null item or clipboard format)\n");
 	return WDML_QS_ERROR;
diff --git a/dlls/user/resource.c b/dlls/user/resource.c
index 2600339..56b5c7a 100644
--- a/dlls/user/resource.c
+++ b/dlls/user/resource.c
@@ -152,7 +152,7 @@
 
   /* Do parameter checking to avoid the explosions and the screaming
      as far as possible. */
-  if((dst && (entries < 1)) || (src == (HACCEL)NULL) || !accel) {
+  if((dst && (entries < 1)) || (src == NULL) || !accel) {
     WARN_(accel)("Application sent invalid parameters (%p %p %d).\n",
 	 (LPVOID)src, (LPVOID)dst, entries);
     return 0;
@@ -209,7 +209,7 @@
     WARN_(accel)("Application sent invalid parameters (%p %d).\n",
 	 lpaccel, cEntries);
     SetLastError(ERROR_INVALID_PARAMETER);
-    return (HACCEL)NULL;
+    return NULL;
   }
   FIXME_(accel)("should check that the accelerator descriptions are valid,"
 	" return NULL and SetLastError() if not.\n");
@@ -222,7 +222,7 @@
   if(!hAccel) {
     ERR_(accel)("Out of memory.\n");
     SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-    return (HACCEL)NULL;
+    return NULL;
   }
   accel = GlobalLock16(HACCEL_16(hAccel));
   for (i=0;i<cEntries;i++) {
@@ -255,7 +255,7 @@
     WARN_(accel)("Application sent invalid parameters (%p %d).\n",
 	 lpaccel, cEntries);
     SetLastError(ERROR_INVALID_PARAMETER);
-    return (HACCEL)NULL;
+    return NULL;
   }
   FIXME_(accel)("should check that the accelerator descriptions are valid,"
 	" return NULL and SetLastError() if not.\n");
@@ -268,7 +268,7 @@
   if(!hAccel) {
     ERR_(accel)("Out of memory.\n");
     SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-    return (HACCEL)NULL;
+    return NULL;
   }
   accel = GlobalLock16(HACCEL_16(hAccel));
 
diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c
index 663d713..dc81bc5 100644
--- a/dlls/winedos/vga.c
+++ b/dlls/winedos/vga.c
@@ -122,7 +122,7 @@
 
 static void CALLBACK VGA_Poll( LPVOID arg, DWORD low, DWORD high );
 
-static HWND vga_hwnd = (HWND) NULL;
+static HWND vga_hwnd = NULL;
 
 /*
  * For simplicity, I'm creating a second palette.
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index bc14be5..b1fbad2 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -1265,7 +1265,7 @@
 	     * window is already the topmost window, it will not
 	     * activate it.
 	     */
-	    if (GetTopWindow((HWND)0)==hwnd && (wasVisible || GetActiveWindow() == hwnd))
+	    if (GetTopWindow(NULL)==hwnd && (wasVisible || GetActiveWindow() == hwnd))
 	      swp |= SWP_NOACTIVATE;
 
 	    break;
diff --git a/graphics/path.c b/graphics/path.c
index 81cca4a..d74aae5 100644
--- a/graphics/path.c
+++ b/graphics/path.c
@@ -1182,7 +1182,7 @@
    /* Free memory for number-of-points-in-stroke array */
    HeapFree( GetProcessHeap(), 0, pNumPointsInStroke );
 
-   if(hrgn==(HRGN)0)
+   if(hrgn==NULL)
    {
       SetLastError(ERROR_NOT_ENOUGH_MEMORY);
       return FALSE;
diff --git a/objects/enhmetafile.c b/objects/enhmetafile.c
index 73c2bdf..eaff93c 100644
--- a/objects/enhmetafile.c
+++ b/objects/enhmetafile.c
@@ -1609,9 +1609,9 @@
     INT savedMode = 0;
     FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale;
     XFORM savedXform, xform;
-    HPEN hPen = (HPEN)NULL;
-    HBRUSH hBrush = (HBRUSH)NULL;
-    HFONT hFont = (HFONT)NULL;
+    HPEN hPen = NULL;
+    HBRUSH hBrush = NULL;
+    HFONT hFont = NULL;
     POINT pt[2];
 
     if(!lpRect)
diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c
index fbb94f0..c8dc251 100644
--- a/programs/wineconsole/user.c
+++ b/programs/wineconsole/user.c
@@ -150,7 +150,7 @@
     {
 	if (data->curcfg.cursor_visible && PRIVATE(data)->hWnd == GetFocus()) DestroyCaret();
 	if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap);
-	PRIVATE(data)->cursor_bitmap = (HBITMAP)0;
+	PRIVATE(data)->cursor_bitmap = NULL;
 	if (size != 100)
 	{
 	    int		w16b; /* number of bytes per row, aligned on word size */
@@ -417,7 +417,7 @@
     HFONT       hFont, hOldFont;
     int         w, i, buf[256];
 
-    if (!(hDC = GetDC(hWnd))) return (HFONT)0;
+    if (!(hDC = GetDC(hWnd))) return NULL;
     if (!(hFont = CreateFontIndirect(lf))) goto err1;
 
     hOldFont = SelectObject(hDC, hFont);
@@ -469,7 +469,7 @@
  err1:
     if (hDC) ReleaseDC(hWnd, hDC);
 
-    return (HFONT)0;
+    return NULL;
 }
 
 /******************************************************************
diff --git a/programs/winver/winver.c b/programs/winver/winver.c
index 6eaa7ca..8082dd5 100644
--- a/programs/winver/winver.c
+++ b/programs/winver/winver.c
@@ -23,7 +23,7 @@
 
 int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
 {
-   return ShellAbout((HWND)0, PACKAGE_NAME, PACKAGE_STRING, 0);
+   return ShellAbout(NULL, PACKAGE_NAME, PACKAGE_STRING, 0);
 }
 
 /* Local Variables:     */
diff --git a/windows/dialog.c b/windows/dialog.c
index 3a8517a..893a211 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -1264,7 +1264,7 @@
     /* Don't have to send a ShowWindow(SW_HIDE), just do
        SetWindowPos with SWP_HIDEWINDOW as done in Windows */
 
-    SetWindowPos(hwnd, (HWND)0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
+    SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
                  | SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW);
 
     /* unblock dialog loop */
@@ -1811,7 +1811,7 @@
         if(hChildFirst)
         {
             if(bCtrl)
-                retWnd = DIALOG_GetNextTabItem(hwndMain,hChildFirst,(HWND)NULL,fPrevious );
+                retWnd = DIALOG_GetNextTabItem(hwndMain,hChildFirst,NULL,fPrevious );
             else
                 retWnd = hChildFirst;
         }
@@ -1829,7 +1829,7 @@
             hParent = GetParent(hParent);
 	}
         if(!retWnd)
-            retWnd = DIALOG_GetNextTabItem(hwndMain,hwndMain,(HWND)NULL,fPrevious );
+            retWnd = DIALOG_GetNextTabItem(hwndMain,hwndMain,NULL,fPrevious );
     }
     return retWnd;
 }
diff --git a/windows/multimon.c b/windows/multimon.c
index 895fe06..e909538 100644
--- a/windows/multimon.c
+++ b/windows/multimon.c
@@ -42,7 +42,7 @@
     {
         return xPRIMARY_MONITOR;
     }
-    return (HMONITOR)0;
+    return NULL;
 }
 
 /***********************************************************************
@@ -58,7 +58,7 @@
     {
         return xPRIMARY_MONITOR;
     }
-    return (HMONITOR)0;
+    return NULL;
 }
 
 /***********************************************************************
@@ -78,7 +78,7 @@
         return MonitorFromRect(&wp.rcNormalPosition, dwFlags);
     }
 
-    return (HMONITOR)0;
+    return NULL;
 }
 
 /***********************************************************************
diff --git a/windows/painting.c b/windows/painting.c
index e20f796..b1ac1c1 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -1305,8 +1305,8 @@
     /* before it is displayed */
     fg = SetTextColor(hdc, RGB(0, 0, 0));
     bg = SetBkColor(hdc, RGB(255, 255, 255));
-    hbm = (HBITMAP)NULL; hbmsave = (HBITMAP)NULL;
-    memdc = (HDC)NULL; hbsave = (HBRUSH)NULL;
+    hbm = NULL; hbmsave = NULL;
+    memdc = NULL; hbsave = NULL;
     retval = FALSE; /* assume failure */
 
     /* From here on we must use "goto cleanup" when something goes wrong */