- npapi.h: Correct definitions of function pointer prototypes.
authorStefan Ginsberg <stefanginsberg@gmail.com>
Sun, 2 Aug 2009 17:38:27 +0000 (17:38 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Sun, 2 Aug 2009 17:38:27 +0000 (17:38 +0000)
- ntifs.h & cmdata.h : Don't use array size of 0. Fixes C4200.
- wdm.h: Correct definition of 64-bit SLIST_HEADER. Add explicit casts to avoid /W4 warnings in RtlEnlargedUnsignedDivide.
- winddk.h: Add MSVC intrinsic __readfsbyte for KeGetCurrentProcessorNumber. Misc fixes.
- Fix various msvc issues in cmd, setupapi, usetup, win32csr, winlogon, msafd, ws2_32 and ext2lib, most notably:
  - cmd & doskey: Don't use fishy gcc extension to allocate variable-sized arrays from the stack. Use the heap instead.
- Disable warning C4733 for mingw_main too (was only done for mingw_wmain previously).
- advapi32: Pass the correct handles to TRACE -- spotted by MSVC.
- Set the specified register in ecx in MSVC versions of Ke386Wrmsr and Ke386Rdmsr instead of reading from/writing to a random MSR. Yay /W4.

svn path=/trunk/; revision=42342

27 files changed:
reactos/base/applications/cmdutils/doskey/doskey.c
reactos/base/setup/usetup/interface/usetup.c
reactos/base/shell/cmd/cmd.c
reactos/base/shell/cmd/console.c
reactos/base/shell/cmd/memory.c
reactos/base/shell/cmd/misc.c
reactos/base/shell/cmd/mklink.c
reactos/base/shell/cmd/parser.c
reactos/base/system/winlogon/winlogon.c
reactos/dll/cpl/desk/preview.c
reactos/dll/cpl/desk/settings.c
reactos/dll/cpl/input/add.c
reactos/dll/win32/advapi32/reg/reg.c
reactos/dll/win32/msafd/misc/dllmain.c
reactos/dll/win32/setupapi/devinst.c
reactos/dll/win32/setupapi/install.c
reactos/dll/win32/ws2_32/misc/ns.c
reactos/dll/win32/ws2_32/misc/stubs.c
reactos/include/ddk/ntifs.h
reactos/include/ddk/wdm.h
reactos/include/ddk/winddk.h
reactos/include/psdk/npapi.h
reactos/lib/3rdparty/mingw/mingw.rbuild
reactos/lib/cmlib/cmdata.h
reactos/lib/fslib/ext2lib/Mke2fs.c
reactos/ntoskrnl/include/internal/i386/intrin_i.h
reactos/subsystems/win32/csrss/win32csr/alias.c

index e876622..0e597a4 100644 (file)
@@ -19,15 +19,27 @@ static VOID SetInsert(DWORD dwFlag)
 static VOID PrintHistory(VOID)
 {
     DWORD Length = GetConsoleCommandHistoryLength(pszExeName);
+    DWORD BufferLength;
+    PBYTE HistBuf;
+    TCHAR *Hist;
+    TCHAR *HistEnd;
+
     /* On Windows, the ANSI version of GetConsoleCommandHistory requires
      * a buffer twice as large as the actual history length. */
-    BYTE HistBuf[Length * (sizeof(WCHAR) / sizeof(TCHAR))];
-    TCHAR *Hist    = (TCHAR *)HistBuf;
-    TCHAR *HistEnd = (TCHAR *)&HistBuf[Length];
+    BufferLength = Length * (sizeof(WCHAR) / sizeof(TCHAR)) * sizeof(BYTE);
+
+    HistBuf = HeapAlloc(GetProcessHeap(),
+                        HEAP_ZERO_MEMORY,
+                        BufferLength);
+    if (!HistBuf) return;
+    Hist = (TCHAR *)HistBuf;
+    HistEnd = (TCHAR *)&HistBuf[Length];
 
-    if (GetConsoleCommandHistory(Hist, sizeof HistBuf, pszExeName))
+    if (GetConsoleCommandHistory(Hist, BufferLength, pszExeName))
         for (; Hist < HistEnd; Hist += _tcslen(Hist) + 1)
             _tprintf(_T("%s\n"), Hist);
+
+    HeapFree(GetProcessHeap(), 0, HistBuf);
 }
 
 static INT SetMacro(LPTSTR definition)
@@ -65,23 +77,39 @@ static INT SetMacro(LPTSTR definition)
 static VOID PrintMacros(LPTSTR pszExeName, LPTSTR Indent)
 {
     DWORD Length = GetConsoleAliasesLength(pszExeName);
-    BYTE AliasBuf[Length];
-    TCHAR *Alias    = (TCHAR *)AliasBuf;
-    TCHAR *AliasEnd = (TCHAR *)&AliasBuf[Length];
+    PBYTE AliasBuf;
+    TCHAR *Alias;
+    TCHAR *AliasEnd;
+
+    AliasBuf = HeapAlloc(GetProcessHeap(),
+                         HEAP_ZERO_MEMORY,
+                         Length * sizeof(BYTE));
+    if (!AliasBuf) return;
+    Alias = (TCHAR *)AliasBuf;
+    AliasEnd = (TCHAR *)&AliasBuf[Length];
 
-    if (GetConsoleAliases(Alias, sizeof AliasBuf, pszExeName))
+    if (GetConsoleAliases(Alias, Length * sizeof(BYTE), pszExeName))
         for (; Alias < AliasEnd; Alias += _tcslen(Alias) + 1)
             _tprintf(_T("%s%s\n"), Indent, Alias);
+
+    HeapFree(GetProcessHeap(), 0, AliasBuf);
 }
 
 static VOID PrintAllMacros(VOID)
 {
     DWORD Length = GetConsoleAliasExesLength();
-    BYTE ExeNameBuf[Length];
-    TCHAR *ExeName    = (TCHAR *)ExeNameBuf;
-    TCHAR *ExeNameEnd = (TCHAR *)&ExeNameBuf[Length];
+    PBYTE ExeNameBuf;
+    TCHAR *ExeName;
+    TCHAR *ExeNameEnd;
+
+    ExeNameBuf = HeapAlloc(GetProcessHeap(),
+                           HEAP_ZERO_MEMORY,
+                           Length * sizeof(BYTE));
+    if (!ExeNameBuf) return;
+    ExeName = (TCHAR *)ExeNameBuf;
+    ExeNameEnd = (TCHAR *)&ExeNameBuf[Length];
 
-    if (GetConsoleAliasExes(ExeName, sizeof ExeNameBuf))
+    if (GetConsoleAliasExes(ExeName, Length * sizeof(BYTE)))
     {
         for (; ExeName < ExeNameEnd; ExeName += _tcslen(ExeName) + 1)
         {
@@ -90,6 +118,8 @@ static VOID PrintAllMacros(VOID)
             _tprintf(_T("\n"));
         }
     }
+
+    HeapFree(GetProcessHeap(), 0, ExeNameBuf);
 }
 
 static VOID ReadFromFile(LPTSTR param)
index c483812..787ec0c 100644 (file)
@@ -3133,6 +3133,7 @@ PAGE_NUMBER
 FileCopyPage(PINPUT_RECORD Ir)
 {
     COPYCONTEXT CopyContext;
+    unsigned int mem_bar_width;
 
     MUIDisplayPage(FILE_COPY_PAGE);
 
@@ -3153,7 +3154,7 @@ FileCopyPage(PINPUT_RECORD Ir)
                                                 MUIGetString(STRING_SETUPCOPYINGFILES));
 
     // fit memory bars to screen width, distribute them uniform
-    unsigned int mem_bar_width = (xScreen - 26) / 5;
+    mem_bar_width = (xScreen - 26) / 5;
     mem_bar_width -= mem_bar_width % 2;  // make even
     /* ATTENTION: The following progress bars are debug stuff, which should not be translated!! */
     /* Create the paged pool progress bar */
index 0ef2ce2..968d6e5 100644 (file)
@@ -484,15 +484,24 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
 INT
 DoCommand(LPTSTR first, LPTSTR rest, PARSED_COMMAND *Cmd)
 {
-       TCHAR com[_tcslen(first) + _tcslen(rest) + 2];  /* full command line */
+       TCHAR *com;
        TCHAR *cp;
        LPTSTR param;   /* pointer to command's parameters */
        INT cl;
        LPCOMMAND cmdptr;
        BOOL nointernal = FALSE;
+       INT ret;
 
        TRACE ("DoCommand: (\'%s\' \'%s\')\n", debugstr_aw(first), debugstr_aw(rest));
 
+       /* full command line */
+       com = cmd_alloc((_tcslen(first) + _tcslen(rest) + 2) * sizeof(TCHAR));
+       if (com == NULL)
+       {
+               error_out_of_memory();
+               return 1;
+       }
+
        /* If present in the first word, these characters end the name of an
         * internal command and become the beginning of its parameters. */
        cp = first + _tcscspn(first, _T("\t +,/;=[]"));
@@ -526,11 +535,15 @@ DoCommand(LPTSTR first, LPTSTR rest, PARSED_COMMAND *Cmd)
                        if (_tcsicmp(cmdptr->name, _T("echo")) != 0)
                                while (_istspace(*param))
                                        param++;
-                       return cmdptr->func(param);
+                       ret = cmdptr->func(param);
+                       cmd_free(com);
+                       return ret;
                }
        }
 
-       return Execute(com, first, rest, Cmd);
+       ret = Execute(com, first, rest, Cmd);
+       cmd_free(com);
+       return ret;
 }
 
 
index cfed1a4..18541bf 100644 (file)
@@ -125,20 +125,36 @@ static VOID ConWrite(TCHAR *str, DWORD len, DWORD nStdHandle)
        if (bUnicodeOutput)
        {
 #ifndef _UNICODE
-               WCHAR buffer[len];
+               WCHAR *buffer = cmd_alloc(len * sizeof(WCHAR));
+               if (!buffer)
+               {
+                       error_out_of_memory();
+                       return;
+               }
                len = MultiByteToWideChar(OutputCodePage, 0, str, len, buffer, len, NULL, NULL);
                str = (PVOID)buffer;
 #endif
                WriteFile(hOutput, str, len * sizeof(WCHAR), &dwWritten, NULL);
+#ifndef _UNICODE
+               cmd_free(buffer);
+#endif
        }
        else
        {
 #ifdef _UNICODE
-               CHAR buffer[len * MB_LEN_MAX];
+               CHAR *buffer = cmd_alloc(len * MB_LEN_MAX * sizeof(CHAR));
+               if (!buffer)
+               {
+                       error_out_of_memory();
+                       return;
+               }
                len = WideCharToMultiByte(OutputCodePage, 0, str, len, buffer, len * MB_LEN_MAX, NULL, NULL);
                str = (PVOID)buffer;
 #endif
                WriteFile(hOutput, str, len, &dwWritten, NULL);
+#ifdef _UNICODE
+               cmd_free(buffer);
+#endif
        }
 }
 
index 4285326..2b44ce9 100644 (file)
@@ -25,6 +25,7 @@ INT CommandMemory (LPTSTR param)
        TCHAR szAvailPageFile[40];
        TCHAR szTotalVirtual[40];
        TCHAR szAvailVirtual[40];
+       BOOL (WINAPI *GlobalMemoryStatusEx)(LPMEMORYSTATUSEX);
 
        if (!_tcsncmp (param, _T("/?"), 2))
        {
@@ -32,8 +33,8 @@ INT CommandMemory (LPTSTR param)
                return 0;
        }
 
-       BOOL (WINAPI *GlobalMemoryStatusEx)(LPMEMORYSTATUSEX)
-               = GetProcAddress(GetModuleHandle(_T("KERNEL32")), "GlobalMemoryStatusEx");
+       GlobalMemoryStatusEx
+               = (BOOL (WINAPI *)(LPMEMORYSTATUSEX))GetProcAddress(GetModuleHandle(_T("KERNEL32")), "GlobalMemoryStatusEx");
        if (GlobalMemoryStatusEx)
        {
                msex.dwLength = sizeof(MEMORYSTATUSEX);
index f44ff43..4e3947f 100644 (file)
@@ -38,7 +38,8 @@
 /*
  * get a character out-of-band and honor Ctrl-Break characters
  */
-TCHAR cgetchar (VOID)
+TCHAR
+cgetchar (VOID)
 {
        HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
        INPUT_RECORD irBuffer;
index ecd0a81..5c2d123 100644 (file)
@@ -39,9 +39,9 @@ static BOOL CreateJunction(LPCTSTR LinkName, LPCTSTR TargetName)
 
        HMODULE hNTDLL = GetModuleHandle(_T("NTDLL"));
        BOOLEAN (WINAPI *RtlDosPathNameToNtPathName_U)(PCWSTR, PUNICODE_STRING, PCWSTR *, CURDIR *)
-               = (BOOLEAN (WINAPI *)())GetProcAddress(hNTDLL, "RtlDosPathNameToNtPathName_U");
+               = (BOOLEAN (WINAPI *)(PCWSTR, PUNICODE_STRING, PCWSTR *, CURDIR *))GetProcAddress(hNTDLL, "RtlDosPathNameToNtPathName_U");
        VOID (WINAPI *RtlFreeUnicodeString)(PUNICODE_STRING)
-               = (VOID (WINAPI *)())GetProcAddress(hNTDLL, "RtlFreeUnicodeString");
+               = (VOID (WINAPI *)(PUNICODE_STRING))GetProcAddress(hNTDLL, "RtlFreeUnicodeString");
 
        TCHAR TargetFullPath[MAX_PATH];
 #ifdef UNICODE
@@ -177,9 +177,9 @@ cmd_mklink(LPTSTR param)
                 * so load dynamically */
                BOOL (WINAPI *CreateSymbolicLink)(LPCTSTR, LPCTSTR, DWORD)
 #ifdef UNICODE
-                       = (BOOL (WINAPI *)())GetProcAddress(hKernel32, "CreateSymbolicLinkW");
+                       = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, DWORD))GetProcAddress(hKernel32, "CreateSymbolicLinkW");
 #else
-                       = (BOOL (WINAPI *)())GetProcAddress(hKernel32, "CreateSymbolicLinkA");
+                       = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, DWORD))GetProcAddress(hKernel32, "CreateSymbolicLinkA");
 #endif
                if (CreateSymbolicLink && CreateSymbolicLink(Name[0], Name[1], Flags))
                {
@@ -193,9 +193,9 @@ cmd_mklink(LPTSTR param)
                 * so load dynamically */
                BOOL (WINAPI *CreateHardLink)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES)
 #ifdef UNICODE
-                       = (BOOL (WINAPI *)())GetProcAddress(hKernel32, "CreateHardLinkW");
+                       = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES))GetProcAddress(hKernel32, "CreateHardLinkW");
 #else
-                       = (BOOL (WINAPI *)())GetProcAddress(hKernel32, "CreateHardLinkA");
+                       = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES))GetProcAddress(hKernel32, "CreateHardLinkA");
 #endif
                if (CreateHardLink && CreateHardLink(Name[0], Name[1], NULL))
                {
index 02cc998..511625d 100644 (file)
@@ -326,10 +326,11 @@ static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList)
 static PARSED_COMMAND *ParseIf(void)
 {
        PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
+       int Type;
        memset(Cmd, 0, sizeof(PARSED_COMMAND));
        Cmd->Type = C_IF;
 
-       int Type = CurrentTokenType;
+       Type = CurrentTokenType;
        if (_tcsicmp(CurrentToken, _T("/I")) == 0)
        {
                Cmd->If.Flags |= IFFLAG_IGNORECASE;
@@ -619,8 +620,9 @@ static PARSED_COMMAND *ParsePrimary(void)
 
        if (CurChar == _T('@'))
        {
+               PARSED_COMMAND *Cmd;
                ParseChar();
-               PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
+               Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
                Cmd->Type = C_QUIET;
                Cmd->Next = NULL;
                /* @ acts like a unary operator with low precedence,
index 7a10e90..60a9843 100644 (file)
@@ -34,7 +34,7 @@ PlayLogonSoundThread(
        DWORD dwSize = sizeof(szBuffer);
        HMODULE hLibrary;
        SERVICE_STATUS_PROCESS Info;
-       typedef BOOL WINAPI (*PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
+       typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
        PLAYSOUNDW Play;
        ULONG Index = 0;
 
index bee6ac1..1f2cdb2 100644 (file)
@@ -332,7 +332,7 @@ OnPaint(HWND hwnd, PPREVIEW_DATA pPreviewData)
 
     hUser32 = LoadLibrary(_T("user32.dll"));
     if(hUser32 == NULL)
-        return FALSE;
+        return;
 
     DrawCaptionTemp = (DCT_PROC)GetProcAddress(hUser32, (LPCSTR)DCT_ORD);
     DrawMenuBarTemp = (DMBT_PROC)GetProcAddress(hUser32, (LPCSTR)DMBT_ORD);
index 5b05d37..1ede0e7 100644 (file)
@@ -626,11 +626,10 @@ INT_PTR CALLBACK
 SettingsPageProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 {
        PGLOBAL_DATA pGlobalData;
+       TCHAR Message[1024], Title[256];
 
        pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
 
-       TCHAR Message[1024], Title[256];
-
        switch(uMsg)
        {
                case WM_INITDIALOG:
index 5eaaddb..20849f1 100644 (file)
@@ -188,9 +188,11 @@ CreateKeyboardLayoutList(HWND hItemsList)
 
         while (RegEnumKeyEx(hKey, dwIndex, szLayoutID, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
         {
+            INT iIndex;
+
             GetLayoutName(szLayoutID, KeyName);
 
-            INT iIndex = (INT) SendMessage(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
+            iIndex = (INT) SendMessage(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
 
             pstrLayoutID = (PTSTR)HeapAlloc(hProcessHeap, 0, sizeof(szLayoutID));
             lstrcpy(pstrLayoutID, szLayoutID);
index 37a9a14..919e78b 100644 (file)
@@ -4104,7 +4104,7 @@ RegQueryValueExW(HKEY hkeyorg,
     static const int info_size = offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data );
 
     TRACE("(%p,%s,%p,%p,%p,%p=%d)\n",
-          hkey, debugstr_w(name), reserved, type, data, count,
+          hkeyorg, debugstr_w(name), reserved, type, data, count,
           (count && data) ? *count : 0 );
 
     if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER;
@@ -4885,7 +4885,7 @@ RegSetValueA(HKEY hKeyOriginal,
     DWORD ret;
     NTSTATUS Status;
 
-    TRACE("(%p,%s,%d,%s,%d)\n", hKey, debugstr_a(lpSubKey), dwType, debugstr_a(lpData), cbData );
+    TRACE("(%p,%s,%d,%s,%d)\n", hKeyOriginal, debugstr_a(lpSubKey), dwType, debugstr_a(lpData), cbData );
 
     if (dwType != REG_SZ || !lpData) return ERROR_INVALID_PARAMETER;
 
index c06df89..2573ac5 100644 (file)
@@ -683,7 +683,7 @@ WSPSelect(int nfds,
           fd_set *readfds,
           fd_set *writefds,
           fd_set *exceptfds,
-          struct timeval *timeout,
+          const LPTIMEVAL timeout,
           LPINT lpErrno)
 {
     IO_STATUS_BLOCK     IOSB;
index 7385301..cb12d76 100644 (file)
@@ -1409,6 +1409,17 @@ HKEY WINAPI SetupDiCreateDevRegKeyW(
 {
     struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
     HKEY key = INVALID_HANDLE_VALUE;
+    LPWSTR lpGuidString = NULL;
+    LPWSTR DriverKey = NULL; /* {GUID}\Index */
+    LPWSTR pDeviceInstance; /* Points into DriverKey, on the Index field */
+    DWORD Index; /* Index used in the DriverKey name */
+    DWORD rc;
+    HKEY hHWProfileKey = INVALID_HANDLE_VALUE;
+    HKEY hEnumKey = NULL;
+    HKEY hClassKey = NULL;
+    HKEY hDeviceKey = INVALID_HANDLE_VALUE;
+    HKEY hKey = NULL;
+    HKEY RootKey;
 
     TRACE("%p %p %lu %lu %lu %p %s\n", DeviceInfoSet, DeviceInfoData, Scope,
             HwProfile, KeyType, InfHandle, debugstr_w(InfSectionName));
@@ -1450,18 +1461,6 @@ HKEY WINAPI SetupDiCreateDevRegKeyW(
         return INVALID_HANDLE_VALUE;
     }
 
-        LPWSTR lpGuidString = NULL;
-        LPWSTR DriverKey = NULL; /* {GUID}\Index */
-        LPWSTR pDeviceInstance; /* Points into DriverKey, on the Index field */
-        DWORD Index; /* Index used in the DriverKey name */
-        DWORD rc;
-        HKEY hHWProfileKey = INVALID_HANDLE_VALUE;
-        HKEY hEnumKey = NULL;
-        HKEY hClassKey = NULL;
-        HKEY hDeviceKey = INVALID_HANDLE_VALUE;
-        HKEY hKey = NULL;
-        HKEY RootKey;
-
         if (Scope == DICS_FLAG_GLOBAL)
             RootKey = set->HKLM;
         else /* Scope == DICS_FLAG_CONFIGSPECIFIC */
@@ -1670,6 +1669,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
 {
     struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
     BOOL ret = FALSE;
+    SP_DEVINFO_DATA DevInfo;
 
     TRACE("%p %s %s %s %p %x %p\n", DeviceInfoSet, debugstr_w(DeviceName),
         debugstr_guid(ClassGuid), debugstr_w(DeviceDescription),
@@ -1708,8 +1708,6 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
         return FALSE;
     }
 
-        SP_DEVINFO_DATA DevInfo;
-
         if (CreationFlags & DICD_GENERATE_ID)
         {
             /* Generate a new unique ID for this device */
index ff36ad1..a89081c 100644 (file)
@@ -96,9 +96,9 @@ struct needs_callback_info
 
 typedef BOOL (*iterate_fields_func)( HINF hinf, PCWSTR field, void *arg );
 static BOOL GetLineText( HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR *value);
-typedef HRESULT WINAPI (*COINITIALIZE)(IN LPVOID pvReserved);
-typedef HRESULT WINAPI (*COCREATEINSTANCE)(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID *ppv);
-typedef HRESULT WINAPI (*COUNINITIALIZE)(VOID);
+typedef HRESULT (WINAPI *COINITIALIZE)(IN LPVOID pvReserved);
+typedef HRESULT (WINAPI *COCREATEINSTANCE)(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID *ppv);
+typedef HRESULT (WINAPI *COUNINITIALIZE)(VOID);
 
 /* Unicode constants */
 static const WCHAR AddService[] = {'A','d','d','S','e','r','v','i','c','e',0};
index 40e3323..e298b11 100644 (file)
@@ -632,8 +632,9 @@ struct hostent defined in w32api/include/winsock2.h
 
 void free_servent(struct servent* s)
 {
+    char* next;
     HFREE(s->s_name);
-    char* next = s->s_aliases[0];
+    next = s->s_aliases[0];
     while(next) { HFREE(next); next++; }
     s->s_port = 0;
     HFREE(s->s_proto);
@@ -660,10 +661,11 @@ gethostbyname(IN  CONST CHAR FAR* name)
     DNS_STATUS dns_status = {0};
     /* include/WinDNS.h -- look up DNS_RECORD on MSDN */
     PDNS_RECORD dp = 0;
+    PWINSOCK_THREAD_BLOCK p;
 
     addr = GH_INVALID;
 
-    PWINSOCK_THREAD_BLOCK p = NtCurrentTeb()->WinSockData;
+    p = NtCurrentTeb()->WinSockData;
 
     if( !p )
     {
index 1c79d18..60880e3 100644 (file)
@@ -510,13 +510,13 @@ WSAHtons(IN  SOCKET s,
          IN  USHORT hostshort,
          OUT USHORT FAR* lpnetshort)
 {
+    PCATALOG_ENTRY provider;
     if (!WSAINITIALIZED)
     {
         WSASetLastError(WSANOTINITIALISED);
         return SOCKET_ERROR;
     }
 
-    PCATALOG_ENTRY provider;
     if (!ReferenceProviderByHandle((HANDLE)s, &provider))
     {
         WSASetLastError(WSAENOTSOCK);
@@ -599,13 +599,13 @@ WSANtohs(IN  SOCKET s,
          IN  USHORT netshort,
          OUT USHORT FAR* lphostshort)
 {
+    PCATALOG_ENTRY provider;
     if (!WSAINITIALIZED)
     {
         WSASetLastError(WSANOTINITIALISED);
         return SOCKET_ERROR;
     }
 
-    PCATALOG_ENTRY provider;
     if (!ReferenceProviderByHandle((HANDLE)s, &provider))
     {
         WSASetLastError(WSAENOTSOCK);
index 733cc79..5bfba73 100644 (file)
@@ -1093,7 +1093,7 @@ typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
     ULONG           FileAttributes;
     ULONG           FileNameLength;
     ULONG           EaSize;
-    WCHAR           FileName[0];
+    WCHAR           FileName[ANYSIZE_ARRAY];
 } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION;
     
 typedef struct _FILE_ID_FULL_DIR_INFORMATION {
index 318ba24..392a376 100644 (file)
@@ -575,13 +575,13 @@ typedef union _SLIST_HEADER {
         ULONGLONG Reserved:59;\r
         ULONGLONG Region:3;\r
     } Header8;\r
+    struct {\r
         ULONGLONG Depth:16;\r
         ULONGLONG Sequence:48;\r
         ULONGLONG HeaderType:1;\r
         ULONGLONG Init:1;\r
         ULONGLONG Reserved:2;\r
         ULONGLONG NextEntry:60;\r
-    struct {\r
     } Header16;\r
 } SLIST_HEADER, *PSLIST_HEADER;\r
 #else\r
@@ -1956,8 +1956,8 @@ RtlEnlargedUnsignedDivide(
     IN OUT PULONG Remainder)\r
 {\r
     if (Remainder)\r
-        *Remainder = Dividend.QuadPart % Divisor;\r
-    return Dividend.QuadPart / Divisor;\r
+        *Remainder = (ULONG)(Dividend.QuadPart % Divisor);\r
+    return (ULONG)(Dividend.QuadPart / Divisor);\r
 }\r
 \r
 //DECLSPEC_DEPRECATED_DDK\r
index 12f1bf0..5cdbe90 100644 (file)
@@ -5128,9 +5128,17 @@ typedef struct _KFLOATING_SAVE {
   ULONG  Spare1;
 } KFLOATING_SAVE, *PKFLOATING_SAVE;
 
-static __inline
+#ifdef _MSC_VER
+//
+// FIXME: Intrinsics
+//
+unsigned char __readfsbyte(const unsigned long Offset);
+#pragma intrinsic(__readfsbyte)
+#endif
+
+
+FORCEINLINE
 ULONG
-DDKAPI
 KeGetCurrentProcessorNumber(VOID)
 {
 #if defined(__GNUC__)
@@ -5145,7 +5153,7 @@ KeGetCurrentProcessorNumber(VOID)
 #if _MSC_FULL_VER >= 13012035
   return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
 #else
-  __asm { movzx eax, _PCR KPCR.Number }
+  __asm { movzx eax, fs:[0] KPCR.Number }
 #endif
 #else
 #error Unknown compiler
@@ -5945,7 +5953,7 @@ RemoveEntryList(
   OldBlink = Entry->Blink;
   OldFlink->Blink = OldBlink;
   OldBlink->Flink = OldFlink;
-  return (OldFlink == OldBlink);
+  return (BOOLEAN)(OldFlink == OldBlink);
 }
 
 static __inline PLIST_ENTRY
index e5e8bfc..2526657 100644 (file)
 #define WNNC_START                 0x0000000c
 #define WNNC_WAIT_FOR_START        0x00000001
 
-typedef DWORD APIENTRY (*PF_NPGetCaps)(DWORD ndex);
+typedef DWORD (APIENTRY *PF_NPGetCaps)(DWORD ndex);
 
 /* get user */
-typedef DWORD APIENTRY (*PF_NPGetUser)(LPWSTR lpName, LPWSTR lpUserName,
+typedef DWORD (APIENTRY *PF_NPGetUser)(LPWSTR lpName, LPWSTR lpUserName,
  LPDWORD lpnBufferLen);
 
 /* enumeration-related */
-typedef DWORD APIENTRY (*PF_NPOpenEnum)(DWORD dwScope, DWORD dwType, DWORD dwUsage,
+typedef DWORD (APIENTRY *PF_NPOpenEnum)(DWORD dwScope, DWORD dwType, DWORD dwUsage,
  LPNETRESOURCEW lpNetResource, LPHANDLE lphEnum);
-typedef DWORD APIENTRY (*PF_NPEnumResource)(HANDLE hEnum, LPDWORD lpcCount,
+typedef DWORD (APIENTRY *PF_NPEnumResource)(HANDLE hEnum, LPDWORD lpcCount,
  LPVOID lpBuffer, LPDWORD lpBufferSize);
-typedef DWORD APIENTRY (*PF_NPCloseEnum)(HANDLE hEnum);
+typedef DWORD (APIENTRY *PF_NPCloseEnum)(HANDLE hEnum);
 typedef DWORD (APIENTRY *PF_NPGetResourceInformation)(LPNETRESOURCEW lpNetResource,
  LPVOID lpBuffer, LPDWORD lpcbBuffer, LPWSTR* lplpSystem);
 
 /* connection-related */
-typedef DWORD APIENTRY (*PF_NPAddConnection)(LPNETRESOURCEW lpNetResource,
+typedef DWORD (APIENTRY *PF_NPAddConnection)(LPNETRESOURCEW lpNetResource,
  LPWSTR lpPassword, LPWSTR lpUserName);
-typedef DWORD APIENTRY (*PF_NPAddConnection3)(HWND hwndOwner,
+typedef DWORD (APIENTRY *PF_NPAddConnection3)(HWND hwndOwner,
  LPNETRESOURCEW lpNetResource, LPWSTR lpPassword, LPWSTR lpUserName,
  DWORD dwFlags);
-typedef DWORD APIENTRY (*PF_NPCancelConnection)(LPWSTR lpName, BOOL fForce);
-typedef DWORD APIENTRY (*PF_NPGetConnection)(LPWSTR lpLocalName,
+typedef DWORD (APIENTRY *PF_NPCancelConnection)(LPWSTR lpName, BOOL fForce);
+typedef DWORD (APIENTRY *PF_NPGetConnection)(LPWSTR lpLocalName,
  LPWSTR lpRemoteName, LPDWORD lpnBufferLen);
 
 /* network name manipulation */
-typedef DWORD APIENTRY (*PF_NPGetUniversalName)(LPWSTR lpLocalPath,
+typedef DWORD (APIENTRY *PF_NPGetUniversalName)(LPWSTR lpLocalPath,
  DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpnBufferSize);
-typedef DWORD APIENTRY (*PF_NPFormatNetworkName)(LPWSTR lpRemoteName,
+typedef DWORD (APIENTRY *PF_NPFormatNetworkName)(LPWSTR lpRemoteName,
  LPWSTR lpFormattedName, LPDWORD lpnLength, DWORD dwFlags,
  DWORD dwAveCharPerLine);
 
 /* dialogs */
-typedef DWORD APIENTRY (*PF_NPDeviceMode)(HWND hParent);
+typedef DWORD (APIENTRY *PF_NPDeviceMode)(HWND hParent);
 
 /* search dialog */
 #define WNSRCH_REFRESH_FIRST_LEVEL 0x00000001
 
-typedef DWORD APIENTRY (*PF_NPSearchDialog)(HWND hwndParent,
+typedef DWORD (APIENTRY *PF_NPSearchDialog)(HWND hwndParent,
  LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, DWORD cbBuffer,
  LPDWORD lpnFlags);
 
@@ -109,10 +109,10 @@ typedef DWORD APIENTRY (*PF_NPSearchDialog)(HWND hwndParent,
 #define WNPS_DIR  1
 #define WNPS_MULT 2
 
-typedef DWORD APIENTRY (*PF_NPGetPropertyText)(DWORD iButton, DWORD nPropSel,
+typedef DWORD (APIENTRY *PF_NPGetPropertyText)(DWORD iButton, DWORD nPropSel,
  LPWSTR lpName, LPWSTR lpButtonName, DWORD nButtonNameLen, DWORD nType);
 
-typedef DWORD APIENTRY (*PF_NPPropertyDialog)(HWND hwndParent, DWORD iButtonDlg,
+typedef DWORD (APIENTRY *PF_NPPropertyDialog)(HWND hwndParent, DWORD iButtonDlg,
  DWORD nPropSel, LPWSTR lpFileName, DWORD nType);
 
 /* admin */
@@ -123,9 +123,9 @@ typedef DWORD APIENTRY (*PF_NPPropertyDialog)(HWND hwndParent, DWORD iButtonDlg,
 #define WNDN_RMDIR 2
 #define WNDN_MVDIR 3
 
-typedef DWORD APIENTRY (*PF_NPGetDirectoryType)(LPWSTR lpName, LPINT lpType,
+typedef DWORD (APIENTRY *PF_NPGetDirectoryType)(LPWSTR lpName, LPINT lpType,
  BOOL bFlushCache);
-typedef DWORD APIENTRY (*PF_NPDirectoryNotify)(HWND hwnd, LPWSTR lpDir,
+typedef DWORD (APIENTRY *PF_NPDirectoryNotify)(HWND hwnd, LPWSTR lpDir,
  DWORD dwOper);
 
 /* permission editor dialogs */
@@ -133,16 +133,16 @@ typedef DWORD APIENTRY (*PF_NPDirectoryNotify)(HWND hwnd, LPWSTR lpDir,
 #define WNPERMC_AUDIT 0x00000002
 #define WNPERMC_OWNER 0x00000004
 
-typedef DWORD APIENTRY (*PF_NPFMXGetPermCaps)(LPWSTR lpDriveName);
+typedef DWORD (APIENTRY *PF_NPFMXGetPermCaps)(LPWSTR lpDriveName);
 
 #define WNPERM_DLG_PERM  0
 #define WNPERM_DLG_AUDIT 1
 #define WNPERM_DLG_OWNER 2
 
-typedef DWORD APIENTRY (*PF_NPFMXEditPerm)(LPWSTR lpDriveName, HWND hwndFMX,
+typedef DWORD (APIENTRY *PF_NPFMXEditPerm)(LPWSTR lpDriveName, HWND hwndFMX,
  DWORD nDialogType);
 
-typedef DWORD APIENTRY (*PF_NPFMXGetPermHelp)(LPWSTR lpDriveName,
+typedef DWORD (APIENTRY *PF_NPFMXGetPermHelp)(LPWSTR lpDriveName,
  DWORD nDialogType, BOOL fDirectory, LPVOID lpFileNameBuffer,
  LPDWORD lpBufferSize, LPDWORD lpnHelpContext);
 
@@ -160,11 +160,11 @@ VOID WINAPI WNetSetLastErrorW(DWORD err, LPWSTR lpError, LPWSTR lpProviders);
 #define WN_NT_PASSWORD_CHANGED   0x00000002
 
 /* notifications */
-typedef DWORD APIENTRY (*PF_NPLogonNotify)(PLUID lpLogonId,
+typedef DWORD (APIENTRY *PF_NPLogonNotify)(PLUID lpLogonId,
  LPCWSTR lpAuthentInfoType, LPVOID lpAuthentInfo,
  LPCWSTR lpPreviousAuthentInfoType, LPVOID lpPreviousAuthentInfo,
  LPWSTR lpStationName, LPVOID StationHandle, LPWSTR *lpLogonScript);
-typedef DWORD APIENTRY (*PF_NPPasswordChangeNotify)(LPCWSTR lpAuthentInfoType,
+typedef DWORD (APIENTRY *PF_NPPasswordChangeNotify)(LPCWSTR lpAuthentInfoType,
  LPVOID lpAuthentInfo, LPCWSTR lpPreviousAuthentInfoType,
  LPVOID lpPreviousAuthentInfo, LPWSTR lpStationName, LPVOID StationHandle,
  DWORD dwChangeInfo);
@@ -201,9 +201,9 @@ typedef struct _NOTIFYCANCEL
     BOOL   fForce;
 } NOTIFYCANCEL, *LPNOTIFYCANCEL;
 
-typedef DWORD APIENTRY (*PF_AddConnectNotify)(LPNOTIFYINFO lpNotifyInfo,
+typedef DWORD (APIENTRY *PF_AddConnectNotify)(LPNOTIFYINFO lpNotifyInfo,
  LPNOTIFYADD lpAddInfo);
-typedef DWORD APIENTRY (*PF_CancelConnectNotify)(LPNOTIFYINFO lpNotifyInfo,
+typedef DWORD (APIENTRY *PF_CancelConnectNotify)(LPNOTIFYINFO lpNotifyInfo,
  LPNOTIFYADD lpAddInfo);
 
 #endif /* ndef __WINE_NPAPI_H__ */
index 4e0bda3..c41e7a4 100644 (file)
@@ -31,6 +31,7 @@
 <module name="mingw_main" type="staticlibrary" isstartuplib="true" crt="dll">
        <define name="_CRTBLD" />
        <include base="ReactOS">include/reactos/mingw-w64</include>
+       <compilerflag compilerset="msc">/wd4733</compilerflag>
        <file>crt0_c.c</file>
        <file>crtexe.c</file>
        <file>dllargv.c</file>
index 7f2b084..b4a3df7 100644 (file)
@@ -114,7 +114,7 @@ typedef struct _CM_KEY_NODE
     ULONG WorkVar;
     USHORT NameLength;
     USHORT ClassLength;
-    WCHAR Name[0];
+    WCHAR Name[ANYSIZE_ARRAY];
 } CM_KEY_NODE, *PCM_KEY_NODE;
 
 //
@@ -122,7 +122,7 @@ typedef struct _CM_KEY_NODE
 //
 typedef struct _VALUE_LIST_CELL
 {
-    HCELL_INDEX ValueOffset[0];
+    HCELL_INDEX ValueOffset[ANYSIZE_ARRAY];
 } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
 
 //
@@ -137,7 +137,7 @@ typedef struct _CM_KEY_VALUE
     ULONG Type;
     USHORT Flags;
     USHORT Unused1;
-    WCHAR Name[0];
+    WCHAR Name[ANYSIZE_ARRAY];
 } CM_KEY_VALUE, *PCM_KEY_VALUE;
 
 //
@@ -152,7 +152,7 @@ typedef struct _CM_KEY_SECURITY
     ULONG ReferenceCount;
     ULONG DescriptorLength;
     //SECURITY_DESCRIPTOR_RELATIVE Descriptor;
-    UCHAR Data[0];
+    UCHAR Data[ANYSIZE_ARRAY];
 } CM_KEY_SECURITY, *PCM_KEY_SECURITY;
 
 #ifdef CMLIB_HOST
index b43af11..5cafd14 100644 (file)
@@ -814,6 +814,10 @@ Ext2Format(
     /* File Sys Structure */
     EXT2_FILESYS     FileSys;
     ULONG Percent;
+    ULONG rsv;
+    ULONG blocks;
+    ULONG start;
+    ULONG ret_blk;
 
 
     Callback(PROGRESS, 0, (PVOID)&Percent);
@@ -917,10 +921,8 @@ Ext2Format(
     }
 
     /* rsv must be a power of two (64kB is MD RAID sb alignment) */
-    ULONG rsv = 65536 / FileSys.blocksize;
-    ULONG blocks = Ext2Sb.s_blocks_count;
-    ULONG start;
-    ULONG ret_blk;
+    rsv = 65536 / FileSys.blocksize;
+    blocks = Ext2Sb.s_blocks_count;
 
 #ifdef ZAP_BOOTBLOCK
     zap_sector(&FileSys, 0, 2);
index 7194505..596c5d6 100644 (file)
@@ -123,6 +123,7 @@ Ke386Wrmsr(IN ULONG Register,
            IN ULONG Var1,
            IN ULONG Var2)
 {
+    __asm mov ecx, Register;
     __asm mov eax, Var1;
     __asm mov edx, Var2;
     __asm wrmsr;
@@ -134,6 +135,7 @@ Ke386Rdmsr(IN ULONG Register,
            IN ULONG Var1,
            IN ULONG Var2)
 {
+    __asm mov ecx, Register;
     __asm mov eax, Var1;
     __asm mov edx, Var2;
     __asm rdmsr;
index 9e48a96..1432be1 100644 (file)
@@ -104,14 +104,17 @@ IntInsertAliasHeader(PALIAS_HEADER * RootHeader, PALIAS_HEADER NewHeader)
 PALIAS_ENTRY
 IntGetAliasEntry(PALIAS_HEADER Header, LPCWSTR lpSrcName)
 {
+    PALIAS_ENTRY RootHeader;
+
     if (Header == NULL)
         return NULL;
 
-    PALIAS_ENTRY RootHeader = Header->Data;
+    RootHeader = Header->Data;
     while(RootHeader)
     {
+        INT diff;
         DPRINT("IntGetAliasEntry>lpSource %S\n", RootHeader->lpSource);
-        INT diff = _wcsicmp(RootHeader->lpSource, lpSrcName);
+        diff = _wcsicmp(RootHeader->lpSource, lpSrcName);
         if (!diff)
             return RootHeader;