diff --git a/reactos/ReactOS-generic.rbuild b/reactos/ReactOS-generic.rbuild
index ec0ef2f04d3..f4915c95289 100644
--- a/reactos/ReactOS-generic.rbuild
+++ b/reactos/ReactOS-generic.rbuild
@@ -110,7 +110,9 @@
-
+
+
+
diff --git a/reactos/base/applications/network/ftp/fake.h b/reactos/base/applications/network/ftp/fake.h
index 68c94cc749f..f622c401970 100644
--- a/reactos/base/applications/network/ftp/fake.h
+++ b/reactos/base/applications/network/ftp/fake.h
@@ -6,8 +6,8 @@
#define getwd getcwd
-#define strcasecmp strcmp
-#define strncasecmp strnicmp
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */
diff --git a/reactos/base/applications/network/net/main.c b/reactos/base/applications/network/net/main.c
index 425b0db393d..f8adf735559 100644
--- a/reactos/base/applications/network/net/main.c
+++ b/reactos/base/applications/network/net/main.c
@@ -20,91 +20,91 @@ int main(int argc, char **argv)
return 1;
}
- if (stricmp(argv[1],"ACCOUNTS")==0)
+ if (_stricmp(argv[1],"ACCOUNTS")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"COMPUTER")==0)
+ if (_stricmp(argv[1],"COMPUTER")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"CONFIG")==0)
+ if (_stricmp(argv[1],"CONFIG")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"CONTINUE")==0)
+ if (_stricmp(argv[1],"CONTINUE")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"FILE")==0)
+ if (_stricmp(argv[1],"FILE")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"GROUP")==0)
+ if (_stricmp(argv[1],"GROUP")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"HELP")==0)
+ if (_stricmp(argv[1],"HELP")==0)
{
return cmdHelp(argc,&argv[1]);
}
- if (stricmp(argv[1],"HELPMSG")==0)
+ if (_stricmp(argv[1],"HELPMSG")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"LOCALGROUP")==0)
+ if (_stricmp(argv[1],"LOCALGROUP")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"NAME")==0)
+ if (_stricmp(argv[1],"NAME")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"PRINT")==0)
+ if (_stricmp(argv[1],"PRINT")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"SEND")==0)
+ if (_stricmp(argv[1],"SEND")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"SESSION")==0)
+ if (_stricmp(argv[1],"SESSION")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"SHARE")==0)
+ if (_stricmp(argv[1],"SHARE")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"START")==0)
+ if (_stricmp(argv[1],"START")==0)
{
return cmdStart(argc, &argv[1]);
}
- if (stricmp(argv[1],"STATISTICS")==0)
+ if (_stricmp(argv[1],"STATISTICS")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"STOP")==0)
+ if (_stricmp(argv[1],"STOP")==0)
{
return cmdStop(argc, &argv[1]);
}
- if (stricmp(argv[1],"TIME")==0)
+ if (_stricmp(argv[1],"TIME")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"USE")==0)
+ if (_stricmp(argv[1],"USE")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"USER")==0)
+ if (_stricmp(argv[1],"USER")==0)
{
- return unimplement();
+ return unimplemented();
}
- if (stricmp(argv[1],"VIEW")==0)
+ if (_stricmp(argv[1],"VIEW")==0)
{
- return unimplement();
+ return unimplemented();
}
help();
@@ -112,9 +112,9 @@ int main(int argc, char **argv)
}
-int unimplement()
+int unimplemented()
{
- puts("This command is not implement yet");
+ puts("This command is not implemented yet");
return 1;
}
diff --git a/reactos/base/applications/network/net/net.h b/reactos/base/applications/network/net/net.h
index e450dff1c51..d86af564206 100644
--- a/reactos/base/applications/network/net/net.h
+++ b/reactos/base/applications/network/net/net.h
@@ -14,7 +14,7 @@
#include
void help();
-int unimplement();
+int unimplemented();
INT cmdHelp(INT argc, CHAR **argv);
diff --git a/reactos/base/applications/network/net/process.c b/reactos/base/applications/network/net/process.c
index 1b57a3d1bf3..4ce29b216df 100644
--- a/reactos/base/applications/network/net/process.c
+++ b/reactos/base/applications/network/net/process.c
@@ -208,7 +208,7 @@ INT row_scanner_service(CHAR *buffer, LONG* pos, LONG size,
}
/* Compare now */
- if (strnicmp(name,&buffer[t],strlen(&buffer[t]))==0)
+ if (_strnicmp(name,&buffer[t],strlen(&buffer[t]))==0)
{
if (save != NULL)
{
diff --git a/reactos/base/applications/network/telnet/telnet.rbuild b/reactos/base/applications/network/telnet/telnet.rbuild
index c4a8b3f0276..312eae39942 100644
--- a/reactos/base/applications/network/telnet/telnet.rbuild
+++ b/reactos/base/applications/network/telnet/telnet.rbuild
@@ -1,10 +1,11 @@
-
+
.
kernel32
ws2_32
user32
+
ansiprsr.cpp
keytrans.cpp
diff --git a/reactos/base/services/dhcp/include/rosdhcp.h b/reactos/base/services/dhcp/include/rosdhcp.h
index 7d115a91564..bcb0b4c4237 100644
--- a/reactos/base/services/dhcp/include/rosdhcp.h
+++ b/reactos/base/services/dhcp/include/rosdhcp.h
@@ -28,6 +28,20 @@
#define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid"
typedef void *VOIDPTR;
+#ifndef _SSIZE_T_DEFINED
+#define _SSIZE_T_DEFINED
+#undef ssize_t
+#ifdef _WIN64
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+ typedef int ssize_t __attribute__ ((mode (DI)));
+#else
+ typedef __int64 ssize_t;
+#endif
+#else
+ typedef int ssize_t;
+#endif
+#endif
+
typedef u_int32_t uintTIME;
#define TIME uintTIME
#include "dhcpd.h"
diff --git a/reactos/base/services/umpnpmgr/umpnpmgr.c b/reactos/base/services/umpnpmgr/umpnpmgr.c
index 39c9e142b8c..19dfdb17e66 100644
--- a/reactos/base/services/umpnpmgr/umpnpmgr.c
+++ b/reactos/base/services/umpnpmgr/umpnpmgr.c
@@ -2062,7 +2062,7 @@ IsConsoleBoot(VOID)
NextOption = wcschr(CurrentOption, L' ');
if (NextOption)
*NextOption = L'\0';
- if (wcsicmp(CurrentOption, L"CONSOLE") == 0)
+ if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
{
DPRINT("Found %S. Switching to console boot\n", CurrentOption);
ConsoleBoot = TRUE;
diff --git a/reactos/base/shell/cmd/batch.c b/reactos/base/shell/cmd/batch.c
index ef282689b3e..93fc56dee23 100644
--- a/reactos/base/shell/cmd/batch.c
+++ b/reactos/base/shell/cmd/batch.c
@@ -269,7 +269,6 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, BOOL forcenew)
SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
bc->bEcho = bEcho; /* Preserve echo across batch calls */
bc->shiftlevel = 0;
- bc->bCmdBlock = -1;
bc->ffind = NULL;
bc->forvar = _T('\0');
@@ -445,39 +444,6 @@ LPTSTR ReadBatchLine ()
first = textline;
- /* cmd block over multiple lines (..) */
- if (bc->bCmdBlock >= 0)
- {
- if (*first == _T(')'))
- {
- first++;
- /* Strip leading spaces and trailing space/control chars */
- while(_istspace (*first))
- first++;
- if ((_tcsncicmp (first, _T("else"), 4) == 0) && (_tcschr(first, _T('('))))
- {
- bc->bExecuteBlock[bc->bCmdBlock] = !bc->bExecuteBlock[bc->bCmdBlock];
- }
- else
- {
- bc->bCmdBlock--;
- }
- continue;
- }
- if (bc->bCmdBlock < MAX_PATH)
- if (!bc->bExecuteBlock[bc->bCmdBlock])
- {
- /* increase the bCmdBlock count when there is another conditon which opens a new bracket */
- if ((_tcsncicmp (first, _T("if"), 2) == 0) && _tcschr(first, _T('(')))
- {
- bc->bCmdBlock++;
- if ((bc->bCmdBlock > 0) && (bc->bCmdBlock < MAX_PATH))
- bc->bExecuteBlock[bc->bCmdBlock] = bc->bExecuteBlock[bc->bCmdBlock - 1];
- }
- continue;
- }
- }
-
break;
}
diff --git a/reactos/base/shell/cmd/batch.h b/reactos/base/shell/cmd/batch.h
index 998f85cb026..74be92f6b69 100644
--- a/reactos/base/shell/cmd/batch.h
+++ b/reactos/base/shell/cmd/batch.h
@@ -21,8 +21,6 @@ typedef struct tagBATCHCONTEXT
HANDLE hFind; /* Preserve find handle when doing a for */
REDIRECTION *RedirList;
TCHAR forvar;
- INT bCmdBlock;
- BOOL bExecuteBlock[MAX_PATH];
} BATCH_CONTEXT, *LPBATCH_CONTEXT;
diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c
index 116066c25ff..39593108f7a 100644
--- a/reactos/base/shell/cmd/cmd.c
+++ b/reactos/base/shell/cmd/cmd.c
@@ -879,7 +879,7 @@ ExecuteCommand(PARSED_COMMAND *Cmd)
if(bc)
bNewBatch = FALSE;
- Success = DoCommand(Cmd->CommandLine);
+ Success = DoCommand(Cmd->Command.CommandLine);
if(bNewBatch && bc)
AddBatchRedirection(&Cmd->Redirections);
@@ -903,6 +903,9 @@ ExecuteCommand(PARSED_COMMAND *Cmd)
case C_PIPE:
ExecutePipeline(Cmd);
break;
+ case C_IF:
+ Success = ExecuteIf(Cmd);
+ break;
}
UndoRedirection(Cmd->Redirections, NULL);
diff --git a/reactos/base/shell/cmd/cmd.h b/reactos/base/shell/cmd/cmd.h
index e89c3aeb7a8..5a243b843f9 100644
--- a/reactos/base/shell/cmd/cmd.h
+++ b/reactos/base/shell/cmd/cmd.h
@@ -258,6 +258,15 @@ INT CommandHistory (LPTSTR param);
#endif
+/* Prototypes for IF.C */
+#define IFFLAG_NEGATE 1 /* NOT */
+#define IFFLAG_IGNORECASE 2 /* /I */
+enum { IF_CMDEXTVERSION, IF_DEFINED, IF_ERRORLEVEL, IF_EXIST,
+ IF_STRINGEQ, /* == */
+ IF_EQU, IF_GTR, IF_GEQ, IF_LSS, IF_LEQ, IF_NEQ };
+BOOL ExecuteIf(struct _PARSED_COMMAND *Cmd);
+
+
/* Prototypes for INTERNAL.C */
VOID InitLastPath (VOID);
VOID FreeLastPath (VOID);
@@ -330,15 +339,28 @@ INT CommandMsgbox (LPTSTR);
/* Prototypes from PARSER.C */
-enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_IFFAILURE, C_IFSUCCESS, C_PIPE };
+enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_IFFAILURE, C_IFSUCCESS, C_PIPE, C_IF };
typedef struct _PARSED_COMMAND
{
struct _PARSED_COMMAND *Subcommands;
struct _PARSED_COMMAND *Next;
struct _REDIRECTION *Redirections;
- TCHAR *Tail;
BYTE Type;
- TCHAR CommandLine[];
+ union
+ {
+ struct
+ {
+ TCHAR *Tail;
+ TCHAR CommandLine[];
+ } Command;
+ struct
+ {
+ BYTE Flags;
+ BYTE Operator;
+ TCHAR *LeftArg;
+ TCHAR *RightArg;
+ } If;
+ };
} PARSED_COMMAND;
PARSED_COMMAND *ParseCommand(LPTSTR Line);
VOID EchoCommand(PARSED_COMMAND *Cmd);
diff --git a/reactos/base/shell/cmd/cmdtable.c b/reactos/base/shell/cmd/cmdtable.c
index 516844fa312..9fc7cd25357 100644
--- a/reactos/base/shell/cmd/cmdtable.c
+++ b/reactos/base/shell/cmd/cmdtable.c
@@ -120,7 +120,7 @@ COMMAND cmds[] =
{_T("history"), 0, CommandHistory},
#endif
- {_T("if"), 0, cmd_if},
+// {_T("if"), 0, cmd_if},
#ifdef INCLUDE_CMD_LABEL
{_T("label"), 0, cmd_label},
diff --git a/reactos/base/shell/cmd/if.c b/reactos/base/shell/cmd/if.c
index 061173bedd3..c462ce02710 100644
--- a/reactos/base/shell/cmd/if.c
+++ b/reactos/base/shell/cmd/if.c
@@ -32,15 +32,30 @@
#include
-
-#define X_EXEC 1
-#define X_EMPTY 0x80
-
-INT cmd_if (LPTSTR param)
+static INT GenericCmp(INT (*StringCmp)(LPCTSTR, LPCTSTR),
+ LPCTSTR Left, LPCTSTR Right)
{
- INT x_flag = 0; /* when set cause 'then' clause to be executed */
- LPTSTR pp;
+ TCHAR *end;
+ INT nLeft = _tcstol(Left, &end, 0);
+ if (*end == _T('\0'))
+ {
+ INT nRight = _tcstol(Right, &end, 0);
+ if (*end == _T('\0'))
+ {
+ /* both arguments are numeric */
+ return (nLeft < nRight) ? -1 : (nLeft > nRight);
+ }
+ }
+ return StringCmp(Left, Right);
+}
+BOOL ExecuteIf(PARSED_COMMAND *Cmd)
+{
+ INT result = FALSE; /* when set cause 'then' clause to be executed */
+ LPTSTR param;
+
+#if 0
+ /* FIXME: need to handle IF /?; will require special parsing */
TRACE ("cmd_if: (\'%s\')\n", debugstr_aw(param));
if (!_tcsncmp (param, _T("/?"), 2))
@@ -48,178 +63,89 @@ INT cmd_if (LPTSTR param)
ConOutResPaging(TRUE,STRING_IF_HELP1);
return 0;
}
+#endif
- /* First check if param string begins with 'not' */
- if (!_tcsnicmp (param, _T("not"), 3) && _istspace (*(param + 3)))
+ if (Cmd->If.Operator == IF_CMDEXTVERSION)
{
- x_flag = X_EXEC; /* Remember 'NOT' */
- param += 3; /* Step over 'NOT' */
- while (_istspace (*param)) /* And subsequent spaces */
- param++;
+ /* IF CMDEXTVERSION n: check if Command Extensions version
+ * is greater or equal to n */
+ DWORD n = _tcstoul(Cmd->If.RightArg, ¶m, 10);
+ if (*param != _T('\0'))
+ {
+ error_syntax(Cmd->If.RightArg);
+ return FALSE;
+ }
+ result = (2 >= n);
}
-
- /* Check for 'exist' form */
- if (!_tcsnicmp (param, _T("exist"), 5) && _istspace (*(param + 5)))
+ else if (Cmd->If.Operator == IF_DEFINED)
{
- UINT i;
- BOOL bInside = FALSE;
-
- param += 5;
- while (_istspace (*param))
- param++;
-
- pp = param;
-
- /* find the whole path to the file */
- for(i = 0; i < _tcslen(param); i++)
- {
- if(param[i] == _T('\"'))
- bInside = !bInside;
- if((param[i] == _T(' ')) && !bInside)
- {
- break;
- }
- pp++;
- }
- *pp++ = _T('\0');
- i = 0;
- /* remove quotes */
- while(i < _tcslen(param))
- {
- if(param[i] == _T('\"'))
- memmove(¶m[i],¶m[i + 1], _tcslen(¶m[i]) * sizeof(TCHAR));
- else
- i++;
- }
-
- if (*pp)
- {
- WIN32_FIND_DATA f;
- HANDLE hFind;
-
- hFind = FindFirstFile (param, &f);
- x_flag ^= (hFind == INVALID_HANDLE_VALUE) ? 0 : X_EXEC;
- if (hFind != INVALID_HANDLE_VALUE)
- {
- FindClose (hFind);
- }
- }
- else
- return 0;
+ /* IF DEFINED var: check if environment variable exists */
+ result = (GetEnvVarOrSpecial(Cmd->If.RightArg) != NULL);
}
- else if (!_tcsnicmp (param, _T("defined"), 7) && _istspace (*(param + 7)))
+ else if (Cmd->If.Operator == IF_ERRORLEVEL)
{
- /* Check for 'defined' form */
- TCHAR Value [1];
- INT ValueSize = 0;
-
- param += 7;
- /* IF [NOT] DEFINED var COMMAND */
- /* ^ */
- while (_istspace (*param))
- param++;
- /* IF [NOT] DEFINED var COMMAND */
- /* ^ */
- pp = param;
- while (*pp && !_istspace (*pp))
- pp++;
- /* IF [NOT] DEFINED var COMMAND */
- /* ^ */
- if (*pp)
+ /* IF ERRORLEVEL n: check if last exit code is greater or equal to n */
+ INT n = _tcstol(Cmd->If.RightArg, ¶m, 10);
+ if (*param != _T('\0'))
{
- *pp++ = _T('\0');
- ValueSize = GetEnvironmentVariable(param, Value, sizeof(Value) / sizeof(Value[0]));
- x_flag ^= (0 == ValueSize)
- ? 0
- : X_EXEC;
- x_flag |= X_EMPTY;
+ error_syntax(Cmd->If.RightArg);
+ return FALSE;
}
- else
- return 0;
+ result = (nErrorLevel >= n);
}
- else if (!_tcsnicmp (param, _T("errorlevel"), 10) && _istspace (*(param + 10)))
+ else if (Cmd->If.Operator == IF_EXIST)
{
- /* Check for 'errorlevel' form */
- INT n = 0;
+ /* IF EXIST filename: check if file exists (wildcards allowed) */
+ WIN32_FIND_DATA f;
+ HANDLE hFind;
- pp = param + 10;
- while (_istspace (*pp))
- pp++;
+ StripQuotes(Cmd->If.RightArg);
- while (_istdigit (*pp))
- n = n * 10 + (*pp++ - _T('0'));
-
- x_flag ^= (nErrorLevel != n) ? 0 : X_EXEC;
-
- x_flag |= X_EMPTY; /* Syntax error if comd empty */
+ hFind = FindFirstFile(Cmd->If.RightArg, &f);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ result = TRUE;
+ FindClose(hFind);
+ }
}
else
{
- BOOL bInQuote = FALSE;
- INT p1len;
- pp = param;
- while ( *pp && ( bInQuote || *pp != _T('=') ) )
- {
- if ( *pp == _T('\"') )
- bInQuote = !bInQuote;
- ++pp;
- }
- p1len = pp-param;
- /* check for "==" */
- if ( *pp++ != _T('=') || *pp++ != _T('=') )
- {
- error_syntax ( NULL );
- return 1;
- }
- while (_istspace (*pp)) /* Skip subsequent spaces */
- pp++;
+ /* Do case-insensitive string comparisons if /I specified */
+ INT (*StringCmp)(LPCTSTR, LPCTSTR) =
+ (Cmd->If.Flags & IFFLAG_IGNORECASE) ? _tcsicmp : _tcscmp;
- /* are the two sides equal*/
- if ( !_tcsncmp(param,pp,p1len))
- x_flag ^= X_EXEC;
- pp += p1len;
-
- if ( x_flag )
+ if (Cmd->If.Operator == IF_STRINGEQ)
{
- x_flag |= X_EMPTY;
+ /* IF str1 == str2 */
+ result = StringCmp(Cmd->If.LeftArg, Cmd->If.RightArg) == 0;
+ }
+ else
+ {
+ result = GenericCmp(StringCmp, Cmd->If.LeftArg, Cmd->If.RightArg);
+ switch (Cmd->If.Operator)
+ {
+ case IF_EQU: result = (result == 0); break;
+ case IF_NEQ: result = (result != 0); break;
+ case IF_LSS: result = (result < 0); break;
+ case IF_LEQ: result = (result <= 0); break;
+ case IF_GTR: result = (result > 0); break;
+ case IF_GEQ: result = (result >= 0); break;
+ }
}
}
- while (_istspace (*pp)) /* skip spaces */
- pp++;
-
- if (*pp == _T('('))
+ if (result ^ ((Cmd->If.Flags & IFFLAG_NEGATE) != 0))
{
- if (bc)
- {
- pp++;
- bc->bCmdBlock++;
- if ((bc->bCmdBlock >= 0) && (bc->bCmdBlock < MAX_PATH))
- bc->bExecuteBlock[bc->bCmdBlock] = x_flag & X_EXEC;
- /* commands are in the next lines */
- if (*pp == _T('\0'))
- return 0;
- }
+ /* full condition was true, do the command */
+ return ExecuteCommand(Cmd->Subcommands);
}
-
- if (x_flag & X_EMPTY)
+ else
{
- while (_istspace (*pp)) /* Then skip spaces */
- pp++;
-
- if (*pp == _T('\0')) /* If nothing left then syntax err */
- {
- error_syntax (NULL);
- return 1;
- }
+ /* full condition was false, do the "else" command if there is one */
+ if (Cmd->Subcommands->Next)
+ return ExecuteCommand(Cmd->Subcommands->Next);
+ return TRUE;
}
-
- if (x_flag & X_EXEC)
- {
- ParseCommandLine (pp);
- }
-
- return 0;
}
/* EOF */
diff --git a/reactos/base/shell/cmd/internal.c b/reactos/base/shell/cmd/internal.c
index afc553cb2a1..bbbb86d419e 100644
--- a/reactos/base/shell/cmd/internal.c
+++ b/reactos/base/shell/cmd/internal.c
@@ -431,6 +431,12 @@ MakeFullPath(TCHAR * DirPath)
TCHAR *p = DirPath;
INT n;
+ if (CreateDirectory(DirPath, NULL))
+ return TRUE;
+ else if (GetLastError() != ERROR_PATH_NOT_FOUND)
+ return FALSE;
+
+ /* got ERROR_PATH_NOT_FOUND, so try building it up one component at a time */
if (p[0] && p[1] == _T(':'))
p += 2;
while (*p == _T('\\'))
@@ -445,8 +451,6 @@ MakeFullPath(TCHAR * DirPath)
(GetLastError() != ERROR_ALREADY_EXISTS))
return FALSE;
} while (p != NULL);
- if (GetLastError() == ERROR_ALREADY_EXISTS)
- SetLastError(ERROR_SUCCESS);
return TRUE;
}
@@ -457,55 +461,42 @@ MakeFullPath(TCHAR * DirPath)
*/
INT cmd_mkdir (LPTSTR param)
{
- LPTSTR dir; /* pointer to the directory to change to */
- LPTSTR *p = NULL;
- INT argc;
- nErrorLevel = 0;
+ LPTSTR *p;
+ INT argc, i;
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_MKDIR_HELP);
return 0;
}
-
- p = split (param, &argc, FALSE);
- if (argc > 1)
- {
- /*JPP 20-Jul-1998 use standard error message */
- error_too_many_parameters (param);
- freep (p);
- return 1;
- }
- else
- dir = p[0];
-
- if (!dir)
+ p = split (param, &argc, FALSE);
+ if (argc == 0)
{
- ConErrResPuts (STRING_ERROR_REQ_PARAM_MISSING);
+ ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
nErrorLevel = 1;
- if(p != NULL)
- freep (p);
+ freep(p);
return 1;
}
- if (!MakeFullPath(dir))
- {
- if(GetLastError() == ERROR_PATH_NOT_FOUND)
- {
- ConErrResPuts(STRING_MD_ERROR2);
- }
- else
- {
- ErrorMessage (GetLastError(), _T("MD"));
- }
- nErrorLevel = 1;
- freep (p);
- return 1;
- }
+ nErrorLevel = 0;
+ for (i = 0; i < argc; i++)
+ {
+ if (!MakeFullPath(p[i]))
+ {
+ if(GetLastError() == ERROR_PATH_NOT_FOUND)
+ {
+ ConErrResPuts(STRING_MD_ERROR2);
+ }
+ else
+ {
+ ErrorMessage (GetLastError(), _T("MD"));
+ }
+ nErrorLevel = 1;
+ }
+ }
freep (p);
-
- return 0;
+ return nErrorLevel;
}
#endif
diff --git a/reactos/base/shell/cmd/parser.c b/reactos/base/shell/cmd/parser.c
index 287110a2dfa..7c35a57e5d6 100644
--- a/reactos/base/shell/cmd/parser.c
+++ b/reactos/base/shell/cmd/parser.c
@@ -1,3 +1,8 @@
+/*
+ * PARSER.C - command parsing.
+ *
+ */
+
#include
#define C_OP_LOWEST C_MULTI
@@ -6,10 +11,28 @@ static const TCHAR OpString[][3] = { _T("&"), _T("||"), _T("&&"), _T("|") };
static const TCHAR RedirString[][3] = { _T("<"), _T(">"), _T(">>") };
+static const TCHAR *const IfOperatorString[] = {
+ _T("cmdextversion"),
+ _T("defined"),
+ _T("errorlevel"),
+ _T("exist"),
+#define IF_MAX_UNARY IF_EXIST
+ _T("=="),
+ _T("equ"),
+ _T("gtr"),
+ _T("geq"),
+ _T("lss"),
+ _T("leq"),
+ _T("neq"),
+#define IF_MAX_COMPARISON IF_NEQ
+};
+
+/* These three characters act like spaces to the parser in most contexts */
+#define STANDARD_SEPS _T(",;=")
+
static BOOL IsSeparator(TCHAR Char)
{
- /* These three characters act like spaces to the parser */
- return _istspace(Char) || (Char && _tcschr(_T(",;="), Char));
+ return _istspace(Char) || (Char && _tcschr(STANDARD_SEPS, Char));
}
enum { TOK_END, TOK_NORMAL, TOK_OPERATOR, TOK_REDIRECTION,
@@ -70,36 +93,44 @@ static void ParseError()
/* Yes, cmd has a Lexical Analyzer. Whenever the parser gives an "xxx was
* unexpected at this time." message, it shows what the last token read was */
-static int ParseToken(TCHAR ExtraEnd, BOOL PreserveSpace)
+static int ParseToken(TCHAR ExtraEnd, TCHAR *Separators)
{
TCHAR *Out = CurrentToken;
- TCHAR Char = CurChar;
+ TCHAR Char;
int Type;
BOOL bInQuote = FALSE;
- if (!PreserveSpace)
- {
- while (Char != _T('\n') && IsSeparator(Char))
- Char = ParseChar();
- }
-
- while (Char && Char != _T('\n'))
+ for (Char = CurChar; Char && Char != _T('\n'); Char = ParseChar())
{
bInQuote ^= (Char == _T('"'));
if (!bInQuote)
{
- /* Check for all the myriad ways in which this token
- * may be brought to an untimely end. */
+ if (Separators != NULL)
+ {
+ if (_istspace(Char) || _tcschr(Separators, Char))
+ {
+ /* Skip leading separators */
+ if (Out == CurrentToken)
+ continue;
+ break;
+ }
+ }
+
+ /* Check for numbered redirection */
if ((Char >= _T('0') && Char <= _T('9') &&
(ParsePos == &ParseLine[1] || IsSeparator(ParsePos[-2]))
- && (*ParsePos == _T('<') || *ParsePos == _T('>')))
- || _tcschr(_T(")&|<>") + (InsideBlock ? 0 : 1), Char)
- || (!PreserveSpace && IsSeparator(Char))
- || (Char == ExtraEnd))
+ && (*ParsePos == _T('<') || *ParsePos == _T('>'))))
{
break;
}
+ if (Char == ExtraEnd)
+ break;
+ if (InsideBlock && Char == _T(')'))
+ break;
+ if (_tcschr(_T("&|<>"), Char))
+ break;
+
if (Char == _T('^'))
{
Char = ParseChar();
@@ -112,7 +143,6 @@ static int ParseToken(TCHAR ExtraEnd, BOOL PreserveSpace)
if (Out == &CurrentToken[CMDLINE_LENGTH - 1])
break;
*Out++ = Char;
- Char = ParseChar();
}
/* Check if we got at least one character before reaching a special one.
@@ -214,7 +244,7 @@ static BOOL ParseRedirection(REDIRECTION **List)
if (!*Tok)
{
/* The file name was not part of this token, so it'll be the next one */
- if (ParseToken(0, FALSE) != TOK_NORMAL)
+ if (ParseToken(0, STANDARD_SEPS) != TOK_NORMAL)
goto fail;
Tok = CurrentToken;
}
@@ -284,7 +314,7 @@ static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList)
InsideBlock--;
/* Process any trailing redirections */
- while (ParseToken(0, FALSE) == TOK_REDIRECTION)
+ while (ParseToken(0, STANDARD_SEPS) == TOK_REDIRECTION)
{
if (!ParseRedirection(&Cmd->Redirections))
{
@@ -295,6 +325,94 @@ static PARSED_COMMAND *ParseBlock(REDIRECTION *RedirList)
return Cmd;
}
+/* Parse an IF statement */
+static PARSED_COMMAND *ParseIf(void)
+{
+ PARSED_COMMAND *Cmd = cmd_alloc(sizeof(PARSED_COMMAND));
+ memset(Cmd, 0, sizeof(PARSED_COMMAND));
+ Cmd->Type = C_IF;
+
+ int Type = ParseToken(0, STANDARD_SEPS);
+ if (_tcsicmp(CurrentToken, _T("/I")) == 0)
+ {
+ Cmd->If.Flags |= IFFLAG_IGNORECASE;
+ Type = ParseToken(0, STANDARD_SEPS);
+ }
+ if (_tcsicmp(CurrentToken, _T("not")) == 0)
+ {
+ Cmd->If.Flags |= IFFLAG_NEGATE;
+ Type = ParseToken(0, STANDARD_SEPS);
+ }
+
+ if (Type != TOK_NORMAL)
+ {
+ FreeCommand(Cmd);
+ ParseError();
+ return NULL;
+ }
+
+ /* Check for unary operators */
+ for (; Cmd->If.Operator <= IF_MAX_UNARY; Cmd->If.Operator++)
+ {
+ if (_tcsicmp(CurrentToken, IfOperatorString[Cmd->If.Operator]) == 0)
+ {
+ if (ParseToken(0, STANDARD_SEPS) != TOK_NORMAL)
+ {
+ FreeCommand(Cmd);
+ ParseError();
+ return NULL;
+ }
+ Cmd->If.RightArg = cmd_dup(CurrentToken);
+ goto condition_done;
+ }
+ }
+
+ /* It must be a two-argument (comparison) operator. It could be ==, so
+ * the equals sign can't be treated as whitespace here. */
+ Cmd->If.LeftArg = cmd_dup(CurrentToken);
+ ParseToken(0, _T(",;"));
+
+ /* The right argument can come immediately after == */
+ if (_tcsnicmp(CurrentToken, _T("=="), 2) == 0 && CurrentToken[2])
+ {
+ Cmd->If.RightArg = cmd_dup(&CurrentToken[2]);
+ goto condition_done;
+ }
+
+ for (; Cmd->If.Operator <= IF_MAX_COMPARISON; Cmd->If.Operator++)
+ {
+ if (_tcsicmp(CurrentToken, IfOperatorString[Cmd->If.Operator]) == 0)
+ {
+ if (ParseToken(0, STANDARD_SEPS) != TOK_NORMAL)
+ break;
+ Cmd->If.RightArg = cmd_dup(CurrentToken);
+ goto condition_done;
+ }
+ }
+ FreeCommand(Cmd);
+ ParseError();
+ return NULL;
+
+condition_done:
+ Cmd->Subcommands = ParseCommandOp(C_OP_LOWEST);
+ if (Cmd->Subcommands == NULL)
+ {
+ FreeCommand(Cmd);
+ return NULL;
+ }
+ if (_tcsicmp(CurrentToken, _T("else")) == 0)
+ {
+ Cmd->Subcommands->Next = ParseCommandOp(C_OP_LOWEST);
+ if (Cmd->Subcommands->Next == NULL)
+ {
+ FreeCommand(Cmd);
+ return NULL;
+ }
+ }
+
+ return Cmd;
+}
+
static PARSED_COMMAND *ParseCommandPart(void)
{
TCHAR ParsedLine[CMDLINE_LENGTH];
@@ -318,7 +436,7 @@ static PARSED_COMMAND *ParseCommandPart(void)
{
/* "Ignore" the rest of the line.
* (Line continuations will still be parsed, though.) */
- while (ParseToken(0, TRUE) != TOK_END)
+ while (ParseToken(0, NULL) != TOK_END)
;
return NULL;
}
@@ -339,7 +457,7 @@ static PARSED_COMMAND *ParseCommandPart(void)
/* Get the head of the command */
while (1)
{
- Type = ParseToken(_T('('), FALSE);
+ Type = ParseToken(_T('('), STANDARD_SEPS);
if (Type == TOK_NORMAL)
{
Pos = _stpcpy(ParsedLine, CurrentToken);
@@ -367,12 +485,22 @@ static PARSED_COMMAND *ParseCommandPart(void)
}
TailOffset = Pos - ParsedLine;
- /* FIXME: FOR, IF, and REM need special processing by the parser. */
+ /* Check for special forms */
+ if (_tcsicmp(ParsedLine, _T("if")) == 0)
+ {
+ if (RedirList)
+ {
+ ParseError();
+ FreeRedirection(RedirList);
+ return NULL;
+ }
+ return ParseIf();
+ }
/* Now get the tail */
while (1)
{
- Type = ParseToken(0, TRUE);
+ Type = ParseToken(0, NULL);
if (Type == TOK_NORMAL)
{
if (Pos + _tcslen(CurrentToken) >= &ParsedLine[CMDLINE_LENGTH])
@@ -394,13 +522,13 @@ static PARSED_COMMAND *ParseCommandPart(void)
}
}
- Cmd = cmd_alloc(FIELD_OFFSET(PARSED_COMMAND, CommandLine[Pos + 1 - ParsedLine]));
+ Cmd = cmd_alloc(FIELD_OFFSET(PARSED_COMMAND, Command.CommandLine[Pos + 1 - ParsedLine]));
Cmd->Type = C_COMMAND;
Cmd->Next = NULL;
Cmd->Subcommands = NULL;
Cmd->Redirections = RedirList;
- _tcscpy(Cmd->CommandLine, ParsedLine);
- Cmd->Tail = Cmd->CommandLine + TailOffset;
+ _tcscpy(Cmd->Command.CommandLine, ParsedLine);
+ Cmd->Command.Tail = Cmd->Command.CommandLine + TailOffset;
return Cmd;
}
@@ -487,7 +615,7 @@ EchoCommand(PARSED_COMMAND *Cmd)
switch (Cmd->Type)
{
case C_COMMAND:
- ConOutPrintf(_T("%s"), Cmd->CommandLine);
+ ConOutPrintf(_T("%s"), Cmd->Command.CommandLine);
break;
case C_QUIET:
return;
@@ -509,6 +637,23 @@ EchoCommand(PARSED_COMMAND *Cmd)
ConOutPrintf(_T(" %s "), OpString[Cmd->Type - C_OP_LOWEST]);
EchoCommand(Sub->Next);
break;
+ case C_IF:
+ ConOutPrintf(_T("if"));
+ if (Cmd->If.Flags & IFFLAG_IGNORECASE)
+ ConOutPrintf(_T(" /I"));
+ if (Cmd->If.Flags & IFFLAG_NEGATE)
+ ConOutPrintf(_T(" not"));
+ if (Cmd->If.LeftArg)
+ ConOutPrintf(_T(" %s"), Cmd->If.LeftArg);
+ ConOutPrintf(_T(" %s %s "), IfOperatorString[Cmd->If.Operator], Cmd->If.RightArg);
+ Sub = Cmd->Subcommands;
+ EchoCommand(Sub);
+ if (Sub->Next)
+ {
+ ConOutPrintf(_T(" else "));
+ EchoCommand(Sub->Next);
+ }
+ break;
}
for (Redir = Cmd->Redirections; Redir; Redir = Redir->Next)
@@ -526,5 +671,10 @@ FreeCommand(PARSED_COMMAND *Cmd)
if (Cmd->Next)
FreeCommand(Cmd->Next);
FreeRedirection(Cmd->Redirections);
+ if (Cmd->Type == C_IF)
+ {
+ cmd_free(Cmd->If.LeftArg);
+ cmd_free(Cmd->If.RightArg);
+ }
cmd_free(Cmd);
}
diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c
index 38d7e23718d..96d1e9e723b 100644
--- a/reactos/base/system/services/rpcserver.c
+++ b/reactos/base/system/services/rpcserver.c
@@ -151,12 +151,12 @@ ScmCreateManagerHandle(LPWSTR lpDatabaseName,
if (lpDatabaseName == NULL)
lpDatabaseName = SERVICES_ACTIVE_DATABASEW;
- if (wcsicmp(lpDatabaseName,SERVICES_FAILED_DATABASEW)==0)
+ if (_wcsicmp(lpDatabaseName,SERVICES_FAILED_DATABASEW)==0)
{
DPRINT1("Database %S, does not exist\n",lpDatabaseName);
return ERROR_DATABASE_DOES_NOT_EXIST;
}
- else if (wcsicmp(lpDatabaseName, SERVICES_ACTIVE_DATABASEW) != 0)
+ else if (_wcsicmp(lpDatabaseName, SERVICES_ACTIVE_DATABASEW) != 0)
{
DPRINT1("Invalid Database name %S.\n",lpDatabaseName);
return ERROR_INVALID_NAME;
@@ -332,7 +332,7 @@ Int_EnumDependentServicesW(HKEY hServicesKey,
/* Can be more than one Dependencies in the DependOnService string */
while (wcslen(lpszValueBuf + dwDependServiceStrPtr) > 0)
{
- if (wcsicmp(lpszValueBuf + dwDependServiceStrPtr, lpService->lpServiceName) == 0)
+ if (_wcsicmp(lpszValueBuf + dwDependServiceStrPtr, lpService->lpServiceName) == 0)
{
/* Get the current enumed service pointer */
lpCurrentService = ScmGetServiceEntryByName(lpszNameBuf);
@@ -1344,7 +1344,7 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
/* First check, if it's already good */
if (ServiceNameLen > 12 &&
- !wcsnicmp(L"\\SystemRoot\\", CanonName, 12))
+ !_wcsnicmp(L"\\SystemRoot\\", CanonName, 12))
{
*RelativeName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR));
if (*RelativeName == NULL)
@@ -1362,7 +1362,7 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
/* If it has %SystemRoot% prefix, substitute it to \System*/
if (ServiceNameLen > 13 &&
- !wcsnicmp(L"%SystemRoot%\\", CanonName, 13))
+ !_wcsnicmp(L"%SystemRoot%\\", CanonName, 13))
{
/* There is no +sizeof(wchar_t) because the name is less by 1 wchar */
*RelativeName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR));
@@ -1432,7 +1432,7 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
Expanded[ExpandedLen] = 0;
if (ServiceNameLen > ExpandedLen &&
- !wcsnicmp(Expanded, CanonName, ExpandedLen))
+ !_wcsnicmp(Expanded, CanonName, ExpandedLen))
{
/* Only \SystemRoot\ is missing */
*RelativeName = LocalAlloc(LMEM_ZEROINIT,
@@ -1504,7 +1504,7 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
ExpandedLen = LinkTarget.Length / sizeof(WCHAR);
if ((ServiceNameLen > ExpandedLen) &&
- !wcsnicmp(LinkTarget.Buffer, CanonName, ExpandedLen))
+ !_wcsnicmp(LinkTarget.Buffer, CanonName, ExpandedLen))
{
*RelativeName = LocalAlloc(LMEM_ZEROINIT,
(ServiceNameLen - ExpandedLen) * sizeof(WCHAR) + 13*sizeof(WCHAR));
@@ -1584,7 +1584,7 @@ ScmCanonDriverImagePath(DWORD dwStartType,
/* 12 is wcslen(L"\\SystemRoot\\") */
if (ServiceNameLen > 12 &&
- !wcsnicmp(L"\\SystemRoot\\", lpServiceName, 12))
+ !_wcsnicmp(L"\\SystemRoot\\", lpServiceName, 12))
{
/* SystemRoot prefix is already included */
@@ -1609,7 +1609,7 @@ ScmCanonDriverImagePath(DWORD dwStartType,
/* Check if it has %SystemRoot% (len=13) */
if (ServiceNameLen > 13 &&
- !wcsnicmp(L"%%SystemRoot%%\\", lpServiceName, 13))
+ !_wcsnicmp(L"%%SystemRoot%%\\", lpServiceName, 13))
{
/* Substitute %SystemRoot% with \\SystemRoot\\ */
*lpCanonName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR));
@@ -1828,7 +1828,7 @@ DWORD RCreateServiceW(
/* Fill the display name */
if (lpDisplayName != NULL &&
*lpDisplayName != 0 &&
- wcsicmp(lpService->lpDisplayName, lpDisplayName) != 0)
+ _wcsicmp(lpService->lpDisplayName, lpDisplayName) != 0)
{
lpService->lpDisplayName = (WCHAR*) HeapAlloc(GetProcessHeap(), 0,
(wcslen(lpDisplayName) + 1) * sizeof(WCHAR));
diff --git a/reactos/base/system/userinit/userinit.c b/reactos/base/system/userinit/userinit.c
index 5c43608f8ab..7825bac5c0e 100644
--- a/reactos/base/system/userinit/userinit.c
+++ b/reactos/base/system/userinit/userinit.c
@@ -120,7 +120,7 @@ BOOL IsConsoleShell(VOID)
NextOption = wcschr(CurrentOption, L' ');
if (NextOption)
*NextOption = L'\0';
- if (wcsicmp(CurrentOption, L"CONSOLE") == 0)
+ if (_wcsicmp(CurrentOption, L"CONSOLE") == 0)
{
TRACE("Found 'CONSOLE' boot option\n");
ret = TRUE;
diff --git a/reactos/config.template.rbuild b/reactos/config.template.rbuild
index b751cf9c910..ae5fba33f1e 100644
--- a/reactos/config.template.rbuild
+++ b/reactos/config.template.rbuild
@@ -85,4 +85,9 @@
-->
+
+
+
diff --git a/reactos/dll/cpl/mmsys/sounds.c b/reactos/dll/cpl/mmsys/sounds.c
index 5f3596c2d96..897116a38ad 100644
--- a/reactos/dll/cpl/mmsys/sounds.c
+++ b/reactos/dll/cpl/mmsys/sounds.c
@@ -697,7 +697,7 @@ LoadSoundFiles(HWND hwndDlg)
if (lResult != CB_ERR)
{
wcscpy(&szPath[length-1], FileData.cFileName);
- SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)wcsdup(szPath));
+ SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)_wcsdup(szPath));
}
}while(FindNextFileW(hFile, &FileData) != 0);
diff --git a/reactos/dll/cpl/sysdm/startrec.c b/reactos/dll/cpl/sysdm/startrec.c
index 5a36c1a60a9..433995191fe 100644
--- a/reactos/dll/cpl/sysdm/startrec.c
+++ b/reactos/dll/cpl/sysdm/startrec.c
@@ -140,9 +140,9 @@ ReadFreeldrSection(HINF hInf, WCHAR *szSectionName)
break;
}
- if (!wcsnicmp(szName, L"BootType", 8))
+ if (!_wcsnicmp(szName, L"BootType", 8))
{
- if (!wcsnicmp(szValue, L"ReactOS", 7))
+ if (!_wcsnicmp(szValue, L"ReactOS", 7))
{
//FIXME store as enum
pRecord->BootType = 1;
@@ -152,11 +152,11 @@ ReadFreeldrSection(HINF hInf, WCHAR *szSectionName)
pRecord->BootType = 0;
}
}
- else if (!wcsnicmp(szName, L"SystemPath", 10))
+ else if (!_wcsnicmp(szName, L"SystemPath", 10))
{
wcscpy(pRecord->szBootPath, szValue);
}
- else if (!wcsnicmp(szName, L"Options", 7))
+ else if (!_wcsnicmp(szName, L"Options", 7))
{
//FIXME store flags as values
wcscpy(pRecord->szOptions, szValue);
@@ -329,12 +329,12 @@ LoadBootSettings(HINF hInf, HWND hwndDlg)
return FALSE;
}
- if (!wcsnicmp(szName, L"timeout", 7))
+ if (!_wcsnicmp(szName, L"timeout", 7))
{
TimeOut = _wtoi(szValue);
}
- if (!wcsnicmp(szName, L"default", 7))
+ if (!_wcsnicmp(szName, L"default", 7))
{
wcscpy(szDefaultOS, szValue);
}
diff --git a/reactos/dll/win32/msgina/msgina.rbuild b/reactos/dll/win32/msgina/msgina.rbuild
index bb8049dde5f..5baa2bcf407 100644
--- a/reactos/dll/win32/msgina/msgina.rbuild
+++ b/reactos/dll/win32/msgina/msgina.rbuild
@@ -2,6 +2,7 @@
.
include
+ include/reactos/wine
ntdll
wine
kernel32
diff --git a/reactos/dll/win32/netcfgx/netcfg_iface.c b/reactos/dll/win32/netcfgx/netcfg_iface.c
index 845bf7213ac..5dc52ec2d5c 100644
--- a/reactos/dll/win32/netcfgx/netcfg_iface.c
+++ b/reactos/dll/win32/netcfgx/netcfg_iface.c
@@ -430,7 +430,7 @@ FindNetworkComponent(
{
while(pHead)
{
- if (!wcsicmp(pHead->szId, pszwComponentId))
+ if (!_wcsicmp(pHead->szId, pszwComponentId))
{
return INetCfgComponent_Constructor(NULL, &IID_INetCfgComponent, (LPVOID*)pComponent, pHead, iface);
}
diff --git a/reactos/dll/win32/netcfgx/tcpipconf_notify.c b/reactos/dll/win32/netcfgx/tcpipconf_notify.c
index 5145cdb0eaa..91c57ec1a2e 100644
--- a/reactos/dll/win32/netcfgx/tcpipconf_notify.c
+++ b/reactos/dll/win32/netcfgx/tcpipconf_notify.c
@@ -2812,7 +2812,7 @@ Initialize(TcpipConfNotifyImpl * This)
{
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
}
- if (!wcsicmp(szBuffer, pStr))
+ if (!_wcsicmp(szBuffer, pStr))
{
bFound = TRUE;
break;
diff --git a/reactos/dll/win32/netshell/connectmanager.c b/reactos/dll/win32/netshell/connectmanager.c
index a0d4da69df6..bb0f0ad7f2a 100644
--- a/reactos/dll/win32/netshell/connectmanager.c
+++ b/reactos/dll/win32/netshell/connectmanager.c
@@ -527,7 +527,7 @@ GetAdapterIndexFromNetCfgInstanceId(PIP_ADAPTER_INFO pAdapterInfo, LPWSTR szNetC
{
szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
}
- if (!wcsicmp(szBuffer, szNetCfg))
+ if (!_wcsicmp(szBuffer, szNetCfg))
{
*pIndex = pCurrentAdapter->Index;
return TRUE;
diff --git a/reactos/dll/win32/netshell/lanconnectui.c b/reactos/dll/win32/netshell/lanconnectui.c
index 1e4b9ce7fa4..4db5aa2630c 100644
--- a/reactos/dll/win32/netshell/lanconnectui.c
+++ b/reactos/dll/win32/netshell/lanconnectui.c
@@ -97,7 +97,7 @@ GetINetCfgComponent(INetCfg * pNCfg, INetConnectionPropertyUiImpl * This, INetCf
hr = INetCfgComponent_GetDisplayName(pNCg, &pName);
if (SUCCEEDED(hr))
{
- if (!wcsicmp(pName, This->pProperties->pszwDeviceName))
+ if (!_wcsicmp(pName, This->pProperties->pszwDeviceName))
{
*pOut = pNCg;
IEnumNetCfgComponent_Release(pEnumCfg);
diff --git a/reactos/dll/win32/netshell/lanstatusui.c b/reactos/dll/win32/netshell/lanstatusui.c
index 6bcf7edeb30..fc267d0fe9f 100644
--- a/reactos/dll/win32/netshell/lanstatusui.c
+++ b/reactos/dll/win32/netshell/lanstatusui.c
@@ -591,7 +591,7 @@ FindNetworkAdapter(HDEVINFO hInfo, SP_DEVINFO_DATA *pDevInfo, LPWSTR pGuid)
break;
}
RegCloseKey(hSubKey);
- if (!wcsicmp(pGuid, szNetCfg))
+ if (!_wcsicmp(pGuid, szNetCfg))
{
return TRUE;
}
diff --git a/reactos/dll/win32/newdev/newdev.c b/reactos/dll/win32/newdev/newdev.c
index 685598a17b0..88e6222386c 100644
--- a/reactos/dll/win32/newdev/newdev.c
+++ b/reactos/dll/win32/newdev/newdev.c
@@ -383,7 +383,7 @@ SearchDriverRecursive(
{
LPCWSTR pszExtension = GetFileExt(FileName);
- if ((wcsicmp(pszExtension, L".inf") == 0) && (wcscmp(LastDirPath, DirPath) != 0))
+ if ((_wcsicmp(pszExtension, L".inf") == 0) && (wcscmp(LastDirPath, DirPath) != 0))
{
wcscpy(LastDirPath, DirPath);
diff --git a/reactos/dll/win32/newdev/wizard.c b/reactos/dll/win32/newdev/wizard.c
index 8f2d4581cd0..df97d7b1f5a 100644
--- a/reactos/dll/win32/newdev/wizard.c
+++ b/reactos/dll/win32/newdev/wizard.c
@@ -365,7 +365,7 @@ SaveCustomPath(
TRACE("ComboBox_GetLBText() failed\n");
goto cleanup;
}
- else if (UseCustomPath && wcsicmp(CustomPath, pBuffer) == 0)
+ else if (UseCustomPath && _wcsicmp(CustomPath, pBuffer) == 0)
UseCustomPath = FALSE;
pBuffer += 1 + Length;
}
diff --git a/reactos/dll/win32/ntmarta/ntmarta.rbuild b/reactos/dll/win32/ntmarta/ntmarta.rbuild
index 0bc6d679953..e04fa190cea 100644
--- a/reactos/dll/win32/ntmarta/ntmarta.rbuild
+++ b/reactos/dll/win32/ntmarta/ntmarta.rbuild
@@ -1,6 +1,7 @@
.
+
0x600
ntdll
kernel32
diff --git a/reactos/dll/win32/shell32/pidl.c b/reactos/dll/win32/shell32/pidl.c
index b146c928a72..9fe93143e60 100644
--- a/reactos/dll/win32/shell32/pidl.c
+++ b/reactos/dll/win32/shell32/pidl.c
@@ -2261,7 +2261,7 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
}
/* display Ext-file as description */
strcpy(pOut, sType);
- strupr(pOut);
+ _strupr(pOut);
/* load localized file string */
sTemp[0] = '\0';
if(LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, sTemp, 64))
diff --git a/reactos/dll/win32/shell32/shelllink.c b/reactos/dll/win32/shell32/shelllink.c
index ce03347f077..ad7f79a035a 100644
--- a/reactos/dll/win32/shell32/shelllink.c
+++ b/reactos/dll/win32/shell32/shelllink.c
@@ -2637,7 +2637,7 @@ SH_ShellLinkDlgProc(
return TRUE;
}
ptr = wcsrchr(szBuffer, L'.');
- if (ptr && !wcsnicmp(ptr, L".lnk", 4))
+ if (ptr && !_wcsnicmp(ptr, L".lnk", 4))
{
// FIXME load localized error msg
MessageBoxW( hwndDlg, L"You cannot create a link to a shortcut", L"Error", MB_ICONERROR );
diff --git a/reactos/dll/win32/shell32/shlexec.c b/reactos/dll/win32/shell32/shlexec.c
index 04c6a685cf9..e994425bd78 100644
--- a/reactos/dll/win32/shell32/shlexec.c
+++ b/reactos/dll/win32/shell32/shlexec.c
@@ -360,7 +360,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path )
while (*p)
{
int len = wcslen(p) + 1;
- if (!wcsnicmp( p, wPath, 5 )) got_path = TRUE;
+ if (!_wcsnicmp( p, wPath, 5 )) got_path = TRUE;
total += len;
p += len;
}
@@ -378,7 +378,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path )
{
int len = wcslen(p) + 1;
memcpy( p2, p, len * sizeof(WCHAR) );
- if (!wcsnicmp( p, wPath, 5 ))
+ if (!_wcsnicmp( p, wPath, 5 ))
{
p2[len - 1] = ';';
wcscpy( p2 + len, path );
@@ -1627,7 +1627,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
/* Remove File Protocol from lpFile */
/* In the case file://path/file */
- if (!wcsnicmp(lpFile, wFile, iSize))
+ if (!_wcsnicmp(lpFile, wFile, iSize))
{
lpFile += iSize;
while (*lpFile == ':') lpFile++;
@@ -1635,7 +1635,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval = execute_from_key(lpstrProtocol, lpFile, NULL, sei_tmp.lpParameters, wcmd, execfunc, &sei_tmp, sei);
}
/* Check if file specified is in the form www.??????.*** */
- else if (!wcsnicmp(lpFile, wWww, 3))
+ else if (!_wcsnicmp(lpFile, wWww, 3))
{
/* if so, append lpFile http:// and call ShellExecute */
WCHAR lpstrTmpFile[256];
diff --git a/reactos/dll/win32/shell32/shv_item_new.c b/reactos/dll/win32/shell32/shv_item_new.c
index ed82b0ab9fa..b1bc56e0273 100644
--- a/reactos/dll/win32/shell32/shv_item_new.c
+++ b/reactos/dll/win32/shell32/shv_item_new.c
@@ -161,13 +161,13 @@ PSHELLNEW_ITEM LoadItem(LPWSTR szKeyName)
pNewItem = HeapAlloc(GetProcessHeap(), 0, sizeof(SHELLNEW_ITEM));
pNewItem->Type = type;
if (szTarget)
- pNewItem->szTarget = wcsdup(szTarget);
+ pNewItem->szTarget = _wcsdup(szTarget);
else
pNewItem->szTarget = NULL;
- pNewItem->szDesc = wcsdup(szDesc);
- pNewItem->szIcon = wcsdup(szIcon);
- pNewItem->szExt = wcsdup(szKeyName);
+ pNewItem->szDesc = _wcsdup(szDesc);
+ pNewItem->szIcon = _wcsdup(szIcon);
+ pNewItem->szExt = _wcsdup(szKeyName);
pNewItem->Next = NULL;
break;
}
@@ -388,7 +388,7 @@ DoShellNewCmd(INewMenuImpl * This, LPCMINVOKECOMMANDINFO lpcmi)
ZeroMemory(&sInfo, sizeof(sInfo));
sInfo.cb = sizeof(sizeof(sInfo));
- szCmd = wcsdup(ptr);
+ szCmd = _wcsdup(ptr);
if (!szCmd)
break;
if (CreateProcessW(NULL, szCmd, NULL, NULL,FALSE,0,NULL,NULL,&sInfo, &pi))
diff --git a/reactos/dll/win32/user32/windows/icon.c b/reactos/dll/win32/user32/windows/icon.c
index 78e1da8de0d..d7f940a6883 100644
--- a/reactos/dll/win32/user32/windows/icon.c
+++ b/reactos/dll/win32/user32/windows/icon.c
@@ -670,13 +670,13 @@ LookupIconIdFromDirectoryEx(PBYTE xdir,
{
ColorBits = 1;
}
- else if (g_psi->SystemMetrics[SM_SAMEDISPLAYFORMAT] || (cFlag & LR_VGACOLOR) )
+ else if (cFlag & LR_VGACOLOR)
{
ColorBits = 4;
}
else
{
- ColorBits = 0;
+ ColorBits = g_psi->BitsPixel;
}
if(bIcon)
diff --git a/reactos/dll/win32/winspool/winspool.rbuild b/reactos/dll/win32/winspool/winspool.rbuild
index 05f7f59642c..21f17347fb4 100644
--- a/reactos/dll/win32/winspool/winspool.rbuild
+++ b/reactos/dll/win32/winspool/winspool.rbuild
@@ -1,6 +1,7 @@
.
+ include/reactos/wine
ntdll
kernel32
diff --git a/reactos/hal/hal.rbuild b/reactos/hal/hal.rbuild
index 5c3e70b2d93..98d50f0dcf8 100644
--- a/reactos/hal/hal.rbuild
+++ b/reactos/hal/hal.rbuild
@@ -10,7 +10,9 @@
-
+
+
+
diff --git a/reactos/include/crt/_mingw.h b/reactos/include/crt/_mingw.h
index afe80a91778..15d5e8c96d1 100644
--- a/reactos/include/crt/_mingw.h
+++ b/reactos/include/crt/_mingw.h
@@ -4,11 +4,12 @@
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#ifndef _INC_CRTDEFS
-#define _INC_CRTDEFS
+#ifndef _INC_MINGW
+#define _INC_MINGW
#define _INTEGRAL_MAX_BITS 64
+// ROS HACK!
#ifndef _WIN64
#ifndef _USE_32BIT_TIME_T
#define _USE_32BIT_TIME_T
@@ -30,69 +31,14 @@
#define __stdcall
#endif
-#if defined(_MSC_VER)
-# ifdef _DLL
-# ifndef __MINGW_IMPORT
-# define __MINGW_IMPORT __declspec(dllimport)
-# endif
-# ifndef _CRTIMP
-# define _CRTIMP __declspec(dllimport)
-# endif
-# else
-# ifndef __MINGW_IMPORT
-# define __MINGW_IMPORT
-# endif
-# ifndef _CRTIMP
-# define _CRTIMP
-# endif
+#ifdef __GNUC__
+ /* These compilers do support __declspec */
+# if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__CYGWIN32__)
+# define __declspec(x) __attribute__((x))
# endif
-# define __DECLSPEC_SUPPORTED
-# define __attribute__(x) /* nothing */
-# define __restrict__ /* nothing */
-#elif defined(__GNUC__)
-# ifdef __declspec
-# ifndef __MINGW_IMPORT
-# ifdef _DLL
-/* Note the extern. This is needed to work around GCC's
-limitations in handling dllimport attribute. */
-# define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
-# else
-# define __MINGW_IMPORT extern
-# endif
-# endif
-# ifndef _CRTIMP
-# undef __USE_CRTIMP
-# if !defined (_CRTBLD) && !defined (_SYSCRT)
-# define __USE_CRTIMP 1
-# endif
-# ifdef __USE_CRTIMP
-# ifdef _DLL
-# define _CRTIMP __attribute__ ((dllimport))
-# else
-# define _CRTIMP
-# endif
-# else
-# define _CRTIMP
-# endif
-# endif
-# define __DECLSPEC_SUPPORTED
-# else /* __declspec */
-# undef __DECLSPEC_SUPPORTED
-# undef __MINGW_IMPORT
-# ifndef _CRTIMP
-# define _CRTIMP
-# endif
-# endif /* __declspec */
#else
-# ifndef __MINGW_IMPORT
-# define __MINGW_IMPORT __declspec(dllimport)
-# endif
-# ifndef _CRTIMP
-# define _CRTIMP __declspec(dllimport)
-# endif
-# define __DECLSPEC_SUPPORTED
# define __attribute__(x) /* nothing */
-#endif /* __GNUC__ */
+#endif
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
#define __MINGW_GNUC_PREREQ(major, minor) \
@@ -102,12 +48,8 @@ limitations in handling dllimport attribute. */
#define __MINGW_GNUC_PREREQ(major, minor) 0
#endif
-#if defined (_MSC_VER)
-#define __MINGW_MSC_PREREQ(major,minor) \
- ((_MSC_VER /100) > (major) \
- || ((_MSC)VER /100) == (major) && (_MSC_VER) % 100) >=(minor)))
-#else
-#define __MINGW_MSC_PREREQ(major, minor) 0
+#if !defined (_MSC_VER)
+#define __MINGW_MSC_PREREQ(major, minor) 0
#endif
#define USE___UUIDOF 0
@@ -115,9 +57,7 @@ limitations in handling dllimport attribute. */
#ifdef __cplusplus
# define __CRT_INLINE inline
#else
-# if defined(_MSC_VER)
-# define __CRT_INLINE __inline
-# elif __GNUC_STDC_INLINE__
+# if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
# define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
# else
# define __CRT_INLINE extern __inline__
@@ -134,6 +74,16 @@ limitations in handling dllimport attribute. */
# endif
#endif
+#ifdef __cplusplus
+# define __unaligned
+#else
+# ifdef __GNUC__
+# define __unaligned __attribute((packed))
+# else
+# define __UNUSED_PARAM(x) x
+# endif
+#endif
+
#ifdef __GNUC__
#define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
#define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
@@ -186,48 +136,25 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
# define __MSVCRT_VERSION__ 0x0700
#endif
-#if defined(__GNUC__)
-#define __mingw_va_start(v,l) __builtin_va_start(v,l)
-#define __mingw_va_end(v) __builtin_va_end(v)
-#define __mingw_va_arg(v,l) __builtin_va_arg(v,l)
-#define __mingw_va_copy(d,s) __builtin_va_copy(d,s)
-#elif defined(_MSC_VER)
-#define __mingw_va_start(v,l) __msc_va_start(v,l)
-#define __mingw_va_end(v) __msc_va_end(v)
-#define __mingw_va_arg(v,l) __msc_va_arg(v,l)
-#define __mingw_va_copy(d,s) __msc_va_copy(d,s)
-#endif
-
//#ifndef WINVER
//#define WINVER 0x0502
//#endif
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x502
-#endif
+//#ifndef _WIN32_WINNT
+//#define _WIN32_WINNT 0x502
+//#endif
-#ifndef _INT128_DEFINED
-#define _INT128_DEFINED
#ifdef __GNUC__
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
#ifdef _WIN64
-
-typedef int __int128 __attribute__ ((mode (TI)));
-
-#endif
-
-#define __ptr32
-#define __ptr64
-#define __unaligned __attribute ((packed))
-#define __forceinline extern __inline
-#endif
-#endif
-
-#ifndef _WIN32
-#error Only Win32 target is supported!
+ typedef int __int128 __attribute__ ((mode (TI)));
+# endif
+# define __ptr32
+# define __ptr64
+# define __forceinline extern __inline __attribute((always_inline))
#endif
#ifdef __cplusplus
@@ -240,190 +167,15 @@ typedef int __int128 __attribute__ ((mode (TI)));
#endif
#endif
-#undef _CRT_PACKING
-#define _CRT_PACKING 8
-
#ifdef _WIN64
#undef USE_MINGW_SETJMP_TWO_ARGS
#define USE_MINGW_SETJMP_TWO_ARGS
#endif
-#pragma pack(push,_CRT_PACKING)
-
-#include
-
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef _CRT_STRINGIZE
-#define __CRT_STRINGIZE(_Value) #_Value
-#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
-#endif
-
-#ifndef _CRT_WIDE
-#define __CRT_WIDE(_String) L ## _String
-#define _CRT_WIDE(_String) __CRT_WIDE(_String)
-#endif
-#ifndef _W64
-#define _W64
-#endif
-
-#ifndef _CRTIMP_NOIA64
-#ifdef __ia64__
-#define _CRTIMP_NOIA64
-#else
-#define _CRTIMP_NOIA64 _CRTIMP
-#endif
-#endif
-
-#ifndef _CRTIMP2
-#define _CRTIMP2 _CRTIMP
-#endif
-
-#ifndef _CRTIMP_ALTERNATIVE
-#define _CRTIMP_ALTERNATIVE _CRTIMP
-#define _CRT_ALTERNATIVE_IMPORTED
-#endif
-
-#ifndef _MRTIMP2
-#define _MRTIMP2 _CRTIMP
-#endif
-
-#ifndef _DLL
-#define _DLL
-#endif
-
-#ifndef _MT
-#define _MT
-#endif
-
-#ifndef _MCRTIMP
-#define _MCRTIMP _CRTIMP
-#endif
-
-#ifndef _CRTIMP_PURE
-#define _CRTIMP_PURE _CRTIMP
-#endif
-
-#ifndef _PGLOBAL
-#define _PGLOBAL
-#endif
-
-#ifndef _AGLOBAL
-#define _AGLOBAL
-#endif
-
-#define __STDC_SECURE_LIB__ 200411L
-#define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
-#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
-#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
-
-#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
-#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
-#endif
-#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
-#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
-#endif
-#ifndef _CRT_MANAGED_HEAP_DEPRECATE
-#define _CRT_MANAGED_HEAP_DEPRECATE
-#endif
-
-#ifndef _CRT_OBSOLETE
-#define _CRT_OBSOLETE(_NewItem)
-#endif
-
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef unsigned int size_t __attribute__ ((mode (DI)));
-#else
- typedef unsigned __int64 size_t;
-#endif
-#else
- typedef unsigned int size_t;
-#endif
-#endif
-
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int ssize_t __attribute__ ((mode (DI)));
-#else
- typedef __int64 ssize_t;
-#endif
-#else
- typedef int ssize_t;
-#endif
-#endif
-
-#ifndef _INTPTR_T_DEFINED
-#define _INTPTR_T_DEFINED
-#ifndef __intptr_t_defined
-#define __intptr_t_defined
-#undef intptr_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int intptr_t __attribute__ ((mode (DI)));
-#else
- typedef __int64 intptr_t;
-#endif
-#else
- typedef int intptr_t;
-#endif
-#endif
-#endif
-
-#ifndef _UINTPTR_T_DEFINED
-#define _UINTPTR_T_DEFINED
-#ifndef __uintptr_t_defined
-#define __uintptr_t_defined
-#undef uintptr_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
-#else
- typedef unsigned __int64 uintptr_t;
-#endif
-#else
- typedef unsigned int uintptr_t;
-#endif
-#endif
-#endif
-
-#ifndef _PTRDIFF_T_DEFINED
-#define _PTRDIFF_T_DEFINED
-#ifndef _PTRDIFF_T_
-#undef ptrdiff_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int ptrdiff_t __attribute__ ((mode (DI)));
-#else
- typedef __int64 ptrdiff_t;
-#endif
-#else
- typedef int ptrdiff_t;
-#endif
-#endif
-#endif
-
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
-#ifndef __cplusplus
- typedef unsigned short wchar_t;
-#endif
-#endif
-
-#ifndef _WCTYPE_T_DEFINED
-#define _WCTYPE_T_DEFINED
- typedef unsigned short wint_t;
- typedef unsigned short wctype_t;
-#endif
-
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
@@ -434,128 +186,15 @@ extern "C" {
typedef __gnuc_va_list va_list;
#endif
-#ifdef _USE_32BIT_TIME_T
-#ifdef _WIN64
-#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
-#undef _USE_32BIT_TIME_T
-#endif
-#else
-#if _INTEGRAL_MAX_BITS < 64
-#define _USE_32BIT_TIME_T
-#endif
+/* Diable deprecation for now! */
+#define _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE_CORE
+#ifdef __WINESRC__
+#define _CRT_NONSTDC_NO_DEPRECATE
#endif
-#ifndef _ERRCODE_DEFINED
-#define _ERRCODE_DEFINED
- typedef int errcode;
- typedef int errno_t;
-#endif
-
-#ifndef _TIME32_T_DEFINED
-#define _TIME32_T_DEFINED
- typedef long __time32_t;
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#define _TIME64_T_DEFINED
-//#if _INTEGRAL_MAX_BITS >= 64
- typedef __int64 __time64_t;
-#endif
-//#endif
-
-#ifndef _TIME_T_DEFINED
-#define _TIME_T_DEFINED
-#ifdef _USE_32BIT_TIME_T
- typedef __time32_t time_t;
-#else
- typedef __time64_t time_t;
-#endif
-#endif
-
-#ifndef _CONST_RETURN
-#define _CONST_RETURN
-#endif
-
-#ifndef __CRT_UNALIGNED
-#define __CRT_UNALIGNED
-#endif
-
-#ifndef UNALIGNED
-#if defined(__ia64__) || defined(__x86_64)
-#define UNALIGNED __unaligned
-#else
-#define UNALIGNED
-#endif
-#endif
-
-#ifndef _CRT_ALIGN
-#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
-#endif
-
-#ifndef _CRTNOALIAS
-#define _CRTNOALIAS
-#endif
-
-#ifndef _CRTRESTRICT
-#define _CRTRESTRICT
-#endif
-
-#ifndef __CRTDECL
-#define __CRTDECL __cdecl
-#endif
-
-#define _ARGMAX 100
-
-#ifndef _TRUNCATE
-#define _TRUNCATE ((size_t)-1)
-#endif
- struct threadlocaleinfostruct;
- struct threadmbcinfostruct;
- typedef struct threadlocaleinfostruct *pthreadlocinfo;
- typedef struct threadmbcinfostruct *pthreadmbcinfo;
- struct __lc_time_data;
-
- typedef struct localeinfo_struct {
- pthreadlocinfo locinfo;
- pthreadmbcinfo mbcinfo;
- } _locale_tstruct,*_locale_t;
-
-#ifndef _TAGLC_ID_DEFINED
-#define _TAGLC_ID_DEFINED
- typedef struct tagLC_ID {
- unsigned short wLanguage;
- unsigned short wCountry;
- unsigned short wCodePage;
- } LC_ID,*LPLC_ID;
-#endif
-
-#ifndef _THREADLOCALEINFO
-#define _THREADLOCALEINFO
- typedef struct threadlocaleinfostruct {
- int refcount;
- unsigned int lc_codepage;
- unsigned int lc_collate_cp;
- unsigned long lc_handle[6];
- LC_ID lc_id[6];
- struct {
- char *locale;
- wchar_t *wlocale;
- int *refcount;
- int *wrefcount;
- } lc_category[6];
- int lc_clike;
- int mb_cur_max;
- int *lconv_intl_refcount;
- int *lconv_num_refcount;
- int *lconv_mon_refcount;
- struct lconv *lconv;
- int *ctype1_refcount;
- unsigned short *ctype1;
- const unsigned short *pctype;
- const unsigned char *pclmap;
- const unsigned char *pcumap;
- struct __lc_time_data *lc_time_curr;
- } threadlocinfo;
+#if (defined(_MSC_VER) && __STDC__)// || !defined(__WINESRC__)
+#define NO_OLDNAMES
#endif
#ifdef __cplusplus
@@ -568,5 +207,26 @@ extern "C" {
#define _CRT_UNUSED(x) (void)x
#endif
-#pragma pack(pop)
+/* These are here for intrin.h */
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+#ifdef _WIN64
+ typedef unsigned __int64 size_t;
+#else
+ typedef unsigned int size_t;
#endif
+#endif
+
+#ifndef _UINTPTR_T_DEFINED
+#define _UINTPTR_T_DEFINED
+#ifdef _WIN64
+ typedef unsigned __int64 uintptr_t;
+#else
+ typedef unsigned int uintptr_t;
+#endif
+#endif
+
+#include
+
+#endif /* !_INC_MINGW */
+
diff --git a/reactos/include/crt/assert.h b/reactos/include/crt/assert.h
index 6340dabad1a..252fd54a269 100644
--- a/reactos/include/crt/assert.h
+++ b/reactos/include/crt/assert.h
@@ -6,53 +6,36 @@
#ifndef __ASSERT_H_
#define __ASSERT_H_
-#include <_mingw.h>
-#ifdef __cplusplus
-#include
-#endif
+#include
#ifdef NDEBUG
+
#ifndef assert
#define assert(_Expression) ((void)0)
#endif
-#else
-#ifndef _CRT_TERMINATE_DEFINED
-#define _CRT_TERMINATE_DEFINED
-__declspec(noreturn) void __cdecl exit(int _Code);
-_CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
-#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
-/* C99 function name */
-void __cdecl __declspec(noreturn) _Exit(int); /* Declare to get noreturn attribute. */
-__CRT_INLINE void __cdecl _Exit(int status)
-{ _exit(status); }
-#endif
-
-#if __MINGW_GNUC_PREREQ(4,4)
-#pragma push_macro("abort")
-#undef abort
-#endif
- void __cdecl __declspec(noreturn) abort(void);
-#if __MINGW_GNUC_PREREQ(4,4)
-#pragma pop_macro("abort")
-#endif
-
-#endif
+#else /* !NDEBUG */
#ifdef __cplusplus
extern "C" {
#endif
-//extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line);
+ _CRTIMP void __cdecl _assert(const char *_Message,const char *_File,unsigned _Line);
+ _CRTIMP void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line);
#ifdef __cplusplus
}
#endif
#ifndef assert
+//#define assert(_Expression) (void)((!!(_Expression)) || (_assert(#_Expression,__FILE__,__LINE__),0))
#define assert(_Expression) (void)((!!(_Expression)))// || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0))
#endif
+#ifndef wassert
+#define wassert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0))
+#endif
+
#endif
#endif
diff --git a/reactos/include/crt/complex.h b/reactos/include/crt/complex.h
index f659dd93d1e..7989a49dc27 100644
--- a/reactos/include/crt/complex.h
+++ b/reactos/include/crt/complex.h
@@ -26,8 +26,7 @@
#ifndef _COMPLEX_H_
#define _COMPLEX_H_
-/* All the headers include this file. */
-#include <_mingw.h>
+#include
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|| !defined __STRICT_ANSI__
diff --git a/reactos/include/crt/conio.h b/reactos/include/crt/conio.h
index 2b71ce6ddb4..0c77d3c3dba 100644
--- a/reactos/include/crt/conio.h
+++ b/reactos/include/crt/conio.h
@@ -6,17 +6,17 @@
#ifndef _INC_CONIO
#define _INC_CONIO
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
#endif
- _CRTIMP char *_cgets(char *_Buffer);
+ _CRTIMP char * __cdecl _cgets(char *_Buffer);
_CRTIMP int __cdecl _cprintf(const char *_Format,...);
_CRTIMP int __cdecl _cputs(const char *_Str);
- _CRTIMP int __cdecl _cscanf(const char *_Format,...);
- _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...);
+ _CRT_INSECURE_DEPRECATE(_cscanf_s) _CRTIMP int __cdecl _cscanf(const char *_Format,...);
+ _CRT_INSECURE_DEPRECATE(_cscanf_s_l) _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...);
_CRTIMP int __cdecl _getch(void);
_CRTIMP int __cdecl _getche(void);
_CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList);
@@ -27,6 +27,12 @@ extern "C" {
_CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...);
_CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList);
_CRTIMP int __cdecl _kbhit(void);
+ _CRTIMP int __cdecl _putch(int _Ch);
+ _CRTIMP int __cdecl _ungetch(int _Ch);
+ _CRTIMP int __cdecl _getch_nolock(void);
+ _CRTIMP int __cdecl _getche_nolock(void);
+ _CRTIMP int __cdecl _putch_nolock(int _Ch);
+ _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
#if defined(_X86_) && !defined(__x86_64)
int __cdecl _inp(unsigned short);
@@ -37,12 +43,6 @@ extern "C" {
unsigned long __cdecl _outpd(unsigned short,unsigned long);
#endif
- _CRTIMP int __cdecl _putch(int _Ch);
- _CRTIMP int __cdecl _ungetch(int _Ch);
- _CRTIMP int __cdecl _getch_nolock(void);
- _CRTIMP int __cdecl _getche_nolock(void);
- _CRTIMP int __cdecl _putch_nolock(int _Ch);
- _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
#ifndef _WCONIO_DEFINED
#define _WCONIO_DEFINED
@@ -58,8 +58,8 @@ extern "C" {
_CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh);
_CRTIMP int __cdecl _cputws(const wchar_t *_String);
_CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...);
- _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...);
- _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...);
+ _CRT_INSECURE_DEPRECATE(_cwscanf_s) _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...);
+ _CRT_INSECURE_DEPRECATE(_cwscanf_s_l) _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...);
_CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList);
_CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...);
_CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList);
@@ -71,31 +71,38 @@ extern "C" {
_CRTIMP wint_t __cdecl _getwch_nolock(void);
_CRTIMP wint_t __cdecl _getwche_nolock(void);
_CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
+#endif /* _WCONIO_DEFINED */
+
+#ifndef _MT
+#define _putwch() _putwch_nolock()
+#define _getwch() _getwch_nolock()
+#define _getwche() _getwche_nolock()
+#define _ungetwch() _ungetwch_nolock()
#endif
#ifndef NO_OLDNAMES
- char *__cdecl cgets(char *_Buffer);
- int __cdecl cprintf(const char *_Format,...);
- int __cdecl cputs(const char *_Str);
- int __cdecl cscanf(const char *_Format,...);
- int __cdecl getch(void);
- int __cdecl getche(void);
- int __cdecl kbhit(void);
- int __cdecl putch(int _Ch);
- int __cdecl ungetch(int _Ch);
+ _CRT_NONSTDC_DEPRECATE(_cgets) _CRT_INSECURE_DEPRECATE(_cgets_s) _CRTIMP char *__cdecl cgets(char *_Buffer);
+ _CRT_NONSTDC_DEPRECATE(_cprintf) _CRTIMP int __cdecl cprintf(const char *_Format,...);
+ _CRT_NONSTDC_DEPRECATE(_cputs) _CRTIMP int __cdecl cputs(const char *_Str);
+ _CRT_NONSTDC_DEPRECATE(_cscanf) _CRTIMP int __cdecl cscanf(const char *_Format,...);
+ _CRT_NONSTDC_DEPRECATE(_getch) _CRTIMP int __cdecl getch(void);
+ _CRT_NONSTDC_DEPRECATE(_getche) _CRTIMP int __cdecl getche(void);
+ _CRT_NONSTDC_DEPRECATE(_kbhit) _CRTIMP int __cdecl kbhit(void);
+ _CRT_NONSTDC_DEPRECATE(_putch) _CRTIMP int __cdecl putch(int _Ch);
+ _CRT_NONSTDC_DEPRECATE(_ungetch) _CRTIMP int __cdecl ungetch(int _Ch);
#if (defined(_X86_) && !defined(__x86_64))
- int __cdecl inp(unsigned short);
- unsigned short __cdecl inpw(unsigned short);
- int __cdecl outp(unsigned short,int);
- unsigned short __cdecl outpw(unsigned short,unsigned short);
+ _CRT_NONSTDC_DEPRECATE(_inp) _CRTIMP int __cdecl inp(unsigned short);
+ _CRT_NONSTDC_DEPRECATE(_inpw) _CRTIMP unsigned short __cdecl inpw(unsigned short);
+ _CRT_NONSTDC_DEPRECATE(_outp) _CRTIMP int __cdecl outp(unsigned short,int);
+ _CRT_NONSTDC_DEPRECATE(_outpw) _CRTIMP unsigned short __cdecl outpw(unsigned short,unsigned short);
#endif
+#endif /* !NO_OLDNAMES */
-#endif
#ifdef __cplusplus
}
#endif
#include
-#endif
+#endif /* _INC_CONIO */
diff --git a/reactos/include/crt/crtdbg.h b/reactos/include/crt/crtdbg.h
index f5d58fe4563..16cf030f5d4 100644
--- a/reactos/include/crt/crtdbg.h
+++ b/reactos/include/crt/crtdbg.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_CRTDBG
#define _INC_CRTDBG
@@ -97,14 +97,26 @@ extern "C" {
#define _ASSERT(expr) ((void)0)
#endif
+#ifndef _ASSERT_WRN
+#define _ASSERT_WRN(expr) ((void)0)
+#endif
+
#ifndef _ASSERTE
#define _ASSERTE(expr) ((void)0)
#endif
+#ifndef _ASSERTE_WRN
+#define _ASSERTE_WRN(expr) ((void)0)
+#endif
+
#ifndef _ASSERT_EXPR
#define _ASSERT_EXPR(expr,expr_str) ((void)0)
#endif
+#ifndef _ASSERT_EXPR_WRN
+#define _ASSERT_EXPR_WRN(expr,expr_str) ((void)0)
+#endif
+
#ifndef _ASSERT_BASE
#define _ASSERT_BASE _ASSERT_EXPR
#endif
diff --git a/reactos/include/crt/crtdefs.h b/reactos/include/crt/crtdefs.h
index ceb864f2513..759b704b34b 100644
--- a/reactos/include/crt/crtdefs.h
+++ b/reactos/include/crt/crtdefs.h
@@ -4,3 +4,389 @@
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#include <_mingw.h>
+
+#ifndef _INC_CRTDEFS
+#define _INC_CRTDEFS
+
+#ifdef _USE_32BIT_TIME_T
+#ifdef _WIN64
+#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
+#undef _USE_32BIT_TIME_T
+#endif
+#else
+#if _INTEGRAL_MAX_BITS < 64
+#define _USE_32BIT_TIME_T
+#endif
+#endif
+
+/* Compatability definition */
+#if _MSC_VER > 0 && __STDC__
+#define NO_OLDNAMES
+#endif
+
+/** Properties ***************************************************************/
+
+#undef _CRT_PACKING
+#define _CRT_PACKING 8
+#pragma pack(push,_CRT_PACKING)
+
+#ifndef _CRT_STRINGIZE
+#define __CRT_STRINGIZE(_Value) #_Value
+#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
+#endif
+
+#ifndef _CRT_WIDE
+#define __CRT_WIDE(_String) L ## _String
+#define _CRT_WIDE(_String) __CRT_WIDE(_String)
+#endif
+
+#ifndef _W64
+ #if !defined(_midl) && defined(_X86_) && _MSC_VER >= 1300
+ #define _W64 __w64
+ #else
+ #define _W64
+ #endif
+#endif
+
+#ifndef _CRTIMP
+ #ifdef _DLL
+ #define _CRTIMP __declspec(dllimport)
+ #else
+ #define _CRTIMP
+ #endif
+#endif
+
+//#define _CRT_ALTERNATIVE_INLINES
+
+#ifndef _CRTIMP_ALT
+ #ifdef _DLL
+ #ifdef _CRT_ALTERNATIVE_INLINES
+ #define _CRTIMP_ALT
+ #else
+ #define _CRTIMP_ALT _CRTIMP
+ #define _CRT_ALTERNATIVE_IMPORTED
+ #endif
+ #else
+ #define _CRTIMP_ALT
+ #endif
+#endif
+
+#ifndef _CRTDATA
+ #ifdef _M_CEE_PURE
+ #define _CRTDATA(x) x
+ #else
+ #define _CRTDATA(x) _CRTIMP x
+ #endif
+#endif
+
+#ifndef _CRTIMP2
+ #define _CRTIMP2 _CRTIMP
+#endif
+
+#ifndef _CRTIMP_PURE
+ #define _CRTIMP_PURE _CRTIMP
+#endif
+
+#ifndef _CRTIMP_ALTERNATIVE
+ #define _CRTIMP_ALTERNATIVE _CRTIMP
+ #define _CRT_ALTERNATIVE_IMPORTED
+#endif
+
+#ifndef _CRTIMP_NOIA64
+ #ifdef __ia64__
+ #define _CRTIMP_NOIA64
+ #else
+ #define _CRTIMP_NOIA64 _CRTIMP
+ #endif
+#endif
+
+#ifndef _MRTIMP2
+ #define _MRTIMP2 _CRTIMP
+#endif
+
+#ifndef _MCRTIMP
+ #define _MCRTIMP _CRTIMP
+#endif
+
+#ifndef _PGLOBAL
+ #define _PGLOBAL
+#endif
+
+#ifndef _AGLOBAL
+ #define _AGLOBAL
+#endif
+
+#ifndef _CONST_RETURN
+ #define _CONST_RETURN
+#endif
+
+#ifndef UNALIGNED
+#if defined(__ia64__) || defined(__x86_64)
+#define UNALIGNED __unaligned
+#else
+#define UNALIGNED
+#endif
+#endif
+
+#ifndef _CRT_ALIGN
+#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
+#endif
+
+#ifndef _CRTNOALIAS
+#define _CRTNOALIAS
+#endif
+
+#ifndef _CRTRESTRICT
+#define _CRTRESTRICT
+#endif
+
+#ifndef __CRTDECL
+#define __CRTDECL __cdecl
+#endif
+
+#ifndef _CRT_UNUSED
+#define _CRT_UNUSED(x) (void)x
+#endif
+
+#ifndef _CONST_RETURN
+#ifdef __cplusplus
+#define _CONST_RETURN const
+#define _CRT_CONST_CORRECT_OVERLOADS
+#else
+#define _CONST_RETURN
+#endif
+#endif
+
+#define __crt_typefix(ctype)
+
+
+/** Deprecated ***************************************************************/
+
+#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
+
+#ifndef _CRT_INSECURE_DEPRECATE
+# ifdef _CRT_SECURE_NO_DEPRECATE
+# define _CRT_INSECURE_DEPRECATE(_Replacement)
+# else
+# define _CRT_INSECURE_DEPRECATE(_Replacement) \
+ _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
+# endif
+#endif
+
+#ifndef _CRT_INSECURE_DEPRECATE_CORE
+# ifdef _CRT_SECURE_NO_DEPRECATE_CORE
+# define _CRT_INSECURE_DEPRECATE_CORE(_Replacement)
+# else
+# define _CRT_INSECURE_DEPRECATE_CORE(_Replacement) \
+ _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead! Enable _CRT_SECURE_NO_DEPRECATE to avoid thie warning.")
+# endif
+#endif
+
+#ifndef _CRT_NONSTDC_DEPRECATE
+# ifdef _CRT_NONSTDC_NO_DEPRECATE
+# define _CRT_NONSTDC_DEPRECATE(_Replacement)
+# else
+# define _CRT_NONSTDC_DEPRECATE(_Replacement) \
+ _CRT_DEPRECATE_TEXT("Deprecated POSIX name, Try " #_Replacement " instead!")
+# endif
+#endif
+
+#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
+#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
+#endif
+
+#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
+#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
+#endif
+
+#ifndef _CRT_MANAGED_HEAP_DEPRECATE
+#define _CRT_MANAGED_HEAP_DEPRECATE
+#endif
+
+#ifndef _CRT_OBSOLETE
+#define _CRT_OBSOLETE(_NewItem)
+#endif
+
+/** Constants ****************************************************************/
+
+#define _ARGMAX 100
+
+#ifndef _TRUNCATE
+#define _TRUNCATE ((size_t)-1)
+#endif
+
+#define __STDC_SECURE_LIB__ 200411L
+#define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
+#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
+
+
+
+/** Type definitions *********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+#undef size_t
+#ifdef _WIN64
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+ typedef unsigned int size_t __attribute__ ((mode (DI)));
+#else
+ typedef unsigned __int64 size_t;
+#endif
+#else
+ typedef unsigned int size_t;
+#endif
+#endif
+
+#ifndef _INTPTR_T_DEFINED
+#define _INTPTR_T_DEFINED
+#ifndef __intptr_t_defined
+#define __intptr_t_defined
+#undef intptr_t
+#ifdef _WIN64
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+ typedef int intptr_t __attribute__ ((mode (DI)));
+#else
+ typedef __int64 intptr_t;
+#endif
+#else
+ typedef int intptr_t;
+#endif
+#endif
+#endif
+
+#ifndef _UINTPTR_T_DEFINED
+#define _UINTPTR_T_DEFINED
+#ifndef __uintptr_t_defined
+#define __uintptr_t_defined
+#undef uintptr_t
+#ifdef _WIN64
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+ typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
+#else
+ typedef unsigned __int64 uintptr_t;
+#endif
+#else
+ typedef unsigned int uintptr_t;
+#endif
+#endif
+#endif
+
+#ifndef _PTRDIFF_T_DEFINED
+#define _PTRDIFF_T_DEFINED
+#ifndef _PTRDIFF_T_
+#undef ptrdiff_t
+#ifdef _WIN64
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+ typedef int ptrdiff_t __attribute__ ((mode (DI)));
+#else
+ typedef __int64 ptrdiff_t;
+#endif
+#else
+ typedef int ptrdiff_t;
+#endif
+#endif
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+#define _WCHAR_T_DEFINED
+#ifndef __cplusplus
+ typedef unsigned short wchar_t;
+#endif
+#endif
+
+#ifndef _WCTYPE_T_DEFINED
+#define _WCTYPE_T_DEFINED
+ typedef unsigned short wint_t;
+ typedef unsigned short wctype_t;
+#endif
+
+#ifndef _ERRCODE_DEFINED
+#define _ERRCODE_DEFINED
+ typedef int errcode;
+ typedef int errno_t;
+#endif
+
+#ifndef _TIME32_T_DEFINED
+#define _TIME32_T_DEFINED
+ typedef long __time32_t;
+#endif
+
+#ifndef _TIME64_T_DEFINED
+#define _TIME64_T_DEFINED
+#if _INTEGRAL_MAX_BITS >= 64
+ typedef __int64 __time64_t;
+#endif
+#endif
+
+#ifndef _TIME_T_DEFINED
+#define _TIME_T_DEFINED
+#ifdef _USE_32BIT_TIME_T
+ typedef __time32_t time_t;
+#else
+ typedef __time64_t time_t;
+#endif
+#endif
+
+ struct threadlocaleinfostruct;
+ typedef struct threadlocaleinfostruct *pthreadlocinfo;
+
+ struct threadmbcinfostruct;
+ typedef struct threadmbcinfostruct *pthreadmbcinfo;
+
+ struct __lc_time_data;
+
+ typedef struct localeinfo_struct {
+ pthreadlocinfo locinfo;
+ pthreadmbcinfo mbcinfo;
+ } _locale_tstruct,*_locale_t;
+
+#ifndef _TAGLC_ID_DEFINED
+#define _TAGLC_ID_DEFINED
+ typedef struct tagLC_ID {
+ unsigned short wLanguage;
+ unsigned short wCountry;
+ unsigned short wCodePage;
+ } LC_ID,*LPLC_ID;
+#endif
+
+#ifndef _THREADLOCALEINFO
+#define _THREADLOCALEINFO
+ typedef struct threadlocaleinfostruct {
+ int refcount;
+ unsigned int lc_codepage;
+ unsigned int lc_collate_cp;
+ unsigned long lc_handle[6];
+ LC_ID lc_id[6];
+ struct {
+ char *locale;
+ wchar_t *wlocale;
+ int *refcount;
+ int *wrefcount;
+ } lc_category[6];
+ int lc_clike;
+ int mb_cur_max;
+ int *lconv_intl_refcount;
+ int *lconv_num_refcount;
+ int *lconv_mon_refcount;
+ struct lconv *lconv;
+ int *ctype1_refcount;
+ unsigned short *ctype1;
+ const unsigned short *pctype;
+ const unsigned char *pclmap;
+ const unsigned char *pcumap;
+ struct __lc_time_data *lc_time_curr;
+ } threadlocinfo;
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#pragma pack(pop)
+
+#endif /* !_INC_CRTDEFS */
diff --git a/reactos/include/crt/ctype.h b/reactos/include/crt/ctype.h
index 45b64091d60..4c899ac608c 100644
--- a/reactos/include/crt/ctype.h
+++ b/reactos/include/crt/ctype.h
@@ -6,7 +6,7 @@
#ifndef _INC_CTYPE
#define _INC_CTYPE
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
@@ -17,69 +17,36 @@ extern "C" {
#endif
#ifndef _CRT_CTYPEDATA_DEFINED
-#define _CRT_CTYPEDATA_DEFINED
-#ifndef _CTYPE_DISABLE_MACROS
-
-#ifndef __PCTYPE_FUNC
-#define __PCTYPE_FUNC __pctype_func()
-#ifdef _MSVCRT_
-#define __pctype_func() (_pctype)
-#else
-#define __pctype_func() (*_imp___pctype)
-#endif
-#endif
-
-#ifndef _pctype
-#ifdef _MSVCRT_
- extern const unsigned short *_pctype;
-#else
- extern const unsigned short **_imp___pctype;
-#define _pctype (*_imp___pctype)
-#endif
-#endif
-
-#endif
-#endif
+# define _CRT_CTYPEDATA_DEFINED
+# ifndef _CTYPE_DISABLE_MACROS
+# ifndef __PCTYPE_FUNC
+# ifdef _DLL
+# define __PCTYPE_FUNC __pctype_func()
+# else
+# define __PCTYPE_FUNC _pctype
+# endif
+# endif /* !__PCTYPE_FUNC */
+ _CRTIMP const unsigned short * __cdecl __pctype_func(void);
+# ifndef _M_CEE_PURE
+ _CRTDATA(extern const unsigned short *_pctype);
+# else
+# define _pctype (__pctype_func())
+# endif /* !_M_CEE_PURE */
+# endif /* !_CTYPE_DISABLE_MACROS */
+#endif /* !_CRT_CTYPEDATA_DEFINED */
#ifndef _CRT_WCTYPEDATA_DEFINED
#define _CRT_WCTYPEDATA_DEFINED
-#ifndef _CTYPE_DISABLE_MACROS
-#ifndef _wctype
-#ifdef _MSVCRT_
- extern unsigned short *_wctype;
-#else
- extern unsigned short **_imp___wctype;
-#define _wctype (*_imp___wctype)
-#endif
-#endif
-#ifdef _MSVCRT_
-#define __pwctype_func() (_pwctype)
-#ifndef _pwctype
- extern const unsigned short *_pwctype;
-#endif
-#else
-#define __pwctype_func() (*_imp___pwctype)
-#ifndef _pwctype
- extern const unsigned short **_imp___pwctype;
-#define _pwctype (*_imp___pwctype)
-#endif
-#endif
-#endif
-#endif
-
- /* CRT stuff */
-#if 1
- extern const unsigned char __newclmap[];
- extern const unsigned char __newcumap[];
- extern pthreadlocinfo __ptlocinfo;
- extern pthreadmbcinfo __ptmbcinfo;
- extern int __globallocalestatus;
- extern int __locale_changed;
- extern struct threadlocaleinfostruct __initiallocinfo;
- extern _locale_tstruct __initiallocalestructinfo;
- pthreadlocinfo __cdecl __updatetlocinfo(void);
- pthreadmbcinfo __cdecl __updatetmbcinfo(void);
-#endif
+# ifndef _CTYPE_DISABLE_MACROS
+ _CRTDATA(extern unsigned short *_wctype);
+ _CRTIMP const wctype_t * __cdecl __pwctype_func(void);
+# ifndef _M_CEE_PURE
+ _CRTDATA(extern const wctype_t *_pwctype);
+# else
+# define _pwctype (__pwctype_func())
+# endif /* !_M_CEE_PURE */
+# endif /* !_CTYPE_DISABLE_MACROS */
+#endif /* !_CRT_WCTYPEDATA_DEFINED */
#define _UPPER 0x1
#define _LOWER 0x2
@@ -96,7 +63,6 @@ extern "C" {
#ifndef _CTYPE_DEFINED
#define _CTYPE_DEFINED
-
_CRTIMP int __cdecl _isctype(int _C,int _Type);
_CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale);
_CRTIMP int __cdecl isalpha(int _C);
@@ -131,51 +97,49 @@ extern "C" {
_CRTIMP int __cdecl __toascii(int _C);
_CRTIMP int __cdecl __iscsymf(int _C);
_CRTIMP int __cdecl __iscsym(int _C);
-
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
int __cdecl isblank(int _C);
#endif
-#endif
+#endif /* !_CTYPE_DEFINED */
#ifndef _WCTYPE_DEFINED
#define _WCTYPE_DEFINED
-
- int __cdecl iswalpha(wint_t _C);
+ _CRTIMP int __cdecl iswalpha(wint_t _C);
_CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswupper(wint_t _C);
+ _CRTIMP int __cdecl iswupper(wint_t _C);
_CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswlower(wint_t _C);
+ _CRTIMP int __cdecl iswlower(wint_t _C);
_CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswdigit(wint_t _C);
+ _CRTIMP int __cdecl iswdigit(wint_t _C);
_CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswxdigit(wint_t _C);
+ _CRTIMP int __cdecl iswxdigit(wint_t _C);
_CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswspace(wint_t _C);
+ _CRTIMP int __cdecl iswspace(wint_t _C);
_CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswpunct(wint_t _C);
+ _CRTIMP int __cdecl iswpunct(wint_t _C);
_CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswalnum(wint_t _C);
+ _CRTIMP int __cdecl iswalnum(wint_t _C);
_CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswprint(wint_t _C);
+ _CRTIMP int __cdecl iswprint(wint_t _C);
_CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswgraph(wint_t _C);
+ _CRTIMP int __cdecl iswgraph(wint_t _C);
_CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswcntrl(wint_t _C);
+ _CRTIMP int __cdecl iswcntrl(wint_t _C);
_CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswascii(wint_t _C);
- int __cdecl isleadbyte(int _C);
+ _CRTIMP int __cdecl iswascii(wint_t _C);
+ _CRTIMP int __cdecl isleadbyte(int _C);
_CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale);
- wint_t __cdecl towupper(wint_t _C);
+ _CRTIMP wint_t __cdecl towupper(wint_t _C);
_CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale);
- wint_t __cdecl towlower(wint_t _C);
+ _CRTIMP wint_t __cdecl towlower(wint_t _C);
_CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswctype(wint_t _C,wctype_t _Type);
+ _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type);
_CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsymf(wint_t _C);
_CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsym(wint_t _C);
_CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale);
- int __cdecl is_wctype(wint_t _C,wctype_t _Type);
+ _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type);
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES)
int __cdecl iswblank(wint_t _C);
@@ -261,12 +225,12 @@ int __cdecl iswblank(wint_t _C);
#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_'))
#endif
-#ifndef NO_OLDNAMES
+#ifndef NO_OLDNAMES
#ifndef _CTYPE_DEFINED
- int __cdecl isascii(int _C);
- int __cdecl toascii(int _C);
- int __cdecl iscsymf(int _C);
- int __cdecl iscsym(int _C);
+ _CRT_NONSTDC_DEPRECATE(__isascii) _CRTIMP int __cdecl isascii(int _C);
+ _CRT_NONSTDC_DEPRECATE(__toascii) _CRTIMP int __cdecl toascii(int _C);
+ _CRT_NONSTDC_DEPRECATE(__iscsymf) _CRTIMP int __cdecl iscsymf(int _C);
+ _CRT_NONSTDC_DEPRECATE(__iscsym) _CRTIMP int __cdecl iscsym(int _C);
#else
#define isascii __isascii
#define toascii __toascii
@@ -278,4 +242,5 @@ int __cdecl iswblank(wint_t _C);
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* !_INC_CTYPE */
diff --git a/reactos/include/crt/direct.h b/reactos/include/crt/direct.h
index 99ce69db700..f64ceba4d7a 100644
--- a/reactos/include/crt/direct.h
+++ b/reactos/include/crt/direct.h
@@ -6,7 +6,7 @@
#ifndef _INC_DIRECT
#define _INC_DIRECT
-#include <_mingw.h>
+#include
#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/dirent.h b/reactos/include/crt/dirent.h
index cd31f59e0cf..57cd7a414bd 100644
--- a/reactos/include/crt/dirent.h
+++ b/reactos/include/crt/dirent.h
@@ -3,8 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-/* All the headers include this file. */
-#include <_mingw.h>
+#include
#ifndef __STRICT_ANSI__
diff --git a/reactos/include/crt/dos.h b/reactos/include/crt/dos.h
index b95dc73280b..3b3ac7d8af7 100644
--- a/reactos/include/crt/dos.h
+++ b/reactos/include/crt/dos.h
@@ -6,7 +6,7 @@
#ifndef _INC_DOS
#define _INC_DOS
-#include <_mingw.h>
+#include
#include
#pragma pack(push,_CRT_PACKING)
@@ -39,8 +39,8 @@ extern "C" {
#endif
#if (defined(_X86_) && !defined(__x86_64))
-// void __cdecl _disable(void);
-// void __cdecl _enable(void);
+ void __cdecl _disable(void);
+ void __cdecl _enable(void);
#endif
#ifndef NO_OLDNAMES
diff --git a/reactos/include/crt/dvec.h b/reactos/include/crt/dvec.h
index 30819bf6a11..5617ffde263 100644
--- a/reactos/include/crt/dvec.h
+++ b/reactos/include/crt/dvec.h
@@ -14,7 +14,7 @@
#include
#include
#include
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/eh.h b/reactos/include/crt/eh.h
index 0feb2dd9c27..3c7725a42c2 100644
--- a/reactos/include/crt/eh.h
+++ b/reactos/include/crt/eh.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _EH_H_
#define _EH_H_
diff --git a/reactos/include/crt/errno.h b/reactos/include/crt/errno.h
index c2df01581c3..944b3ad504b 100644
--- a/reactos/include/crt/errno.h
+++ b/reactos/include/crt/errno.h
@@ -6,7 +6,7 @@
#ifndef _INC_ERRNO
#define _INC_ERRNO
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
diff --git a/reactos/include/crt/excpt.h b/reactos/include/crt/excpt.h
index 64893e3ade6..8a7badba888 100644
--- a/reactos/include/crt/excpt.h
+++ b/reactos/include/crt/excpt.h
@@ -1,103 +1,129 @@
-/*
- * excpt.h
+/**
* This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Support for operating system level structured exception handling.
- *
- * NOTE: This is very preliminary stuff. I am also pretty sure it is
- * completely Intel specific.
- *
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
*/
+#ifndef _INC_EXCPT
+#define _INC_EXCPT
-#ifndef _EXCPT_H_
-#define _EXCPT_H_
+#include
-/* All the headers include this file. */
-#include <_mingw.h>
+#pragma pack(push,_CRT_PACKING)
-/*
- * NOTE: The constants structs and typedefs below should be defined in the
- * Win32 API headers.
- */
-#define EXCEPTION_EXECUTE_HANDLER 1
-#define EXCEPTION_CONTINUE_SEARCH 0
-#define EXCEPTION_CONTINUE_EXECUTION -1
-
-#define EH_NONCONTINUABLE 0x01
-#define EH_UNWINDING 0x02
-#define EH_EXIT_UNWIND 0x04
-#define EH_STACK_INVALID 0x08
-#define EH_NESTED_CALL 0x10
-
-#ifndef RC_INVOKED
-
-typedef enum {
- ExceptionContinueExecution,
- ExceptionContinueSearch,
- ExceptionNestedException,
- ExceptionCollidedUnwind
-} EXCEPTION_DISPOSITION;
-
-
-/*
- * End of stuff that should be in the Win32 API files.
- */
-
-
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
-/*
- * The type of function that is expected as an exception handler to be
- * installed with __try1.
- */
-struct _CONTEXT;
-struct _EXCEPTION_RECORD;
-typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
- (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
-
-/*
- * This is not entirely necessary, but it is the structure installed by
- * the __try1 primitive below.
- */
-typedef struct _EXCEPTION_REGISTRATION
+typedef enum _EXCEPTION_DISPOSITION
{
- struct _EXCEPTION_REGISTRATION* prev;
- PEXCEPTION_HANDLER handler;
-} EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
+ ExceptionContinueExecution,
+ ExceptionContinueSearch,
+ ExceptionNestedException,
+ ExceptionCollidedUnwind,
+} EXCEPTION_DISPOSITION;
-/*
- * A macro which installs the supplied exception handler.
- * Push the pointer to the new handler onto the stack,
- * then push the pointer to the old registration structure (at fs:0)
- * onto the stack, then put a pointer to the new registration
- * structure (i.e. the current stack pointer) at fs:0.
- */
+#if (defined(_X86_) && !defined(__x86_64))
+ struct _EXCEPTION_RECORD;
+ struct _CONTEXT;
+
+ EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext);
+#elif defined(__ia64__)
+
+ typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
+ struct _EXCEPTION_RECORD;
+ struct _CONTEXT;
+ struct _DISPATCHER_CONTEXT;
+
+ _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer);
+#elif defined(__x86_64)
+
+ struct _EXCEPTION_RECORD;
+ struct _CONTEXT;
+ struct _DISPATCHER_CONTEXT;
+
+ _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext);
+#endif
+
+#ifdef _MSC_VER // HACK!!!
+#define GetExceptionCode _exception_code
+#define exception_code _exception_code
+#define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
+#define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
+#define AbnormalTermination _abnormal_termination
+#define abnormal_termination _abnormal_termination
+#endif
+
+ unsigned long __cdecl _exception_code(void);
+ void *__cdecl _exception_info(void);
+ int __cdecl _abnormal_termination(void);
+
+#define EXCEPTION_EXECUTE_HANDLER 1
+#define EXCEPTION_CONTINUE_SEARCH 0
+#define EXCEPTION_CONTINUE_EXECUTION -1
+
+#if 0
+ /* CRT stuff */
+ typedef void (__cdecl * _PHNDLR)(int);
+
+ struct _XCPT_ACTION {
+ unsigned long XcptNum;
+ int SigNum;
+ _PHNDLR XcptAction;
+ };
+
+ extern struct _XCPT_ACTION _XcptActTab[];
+ extern int _XcptActTabCount;
+ extern int _XcptActTabSize;
+ extern int _First_FPE_Indx;
+ extern int _Num_FPE;
+
+ int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr);
+ int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr);
+
+ /*
+ * The type of function that is expected as an exception handler to be
+ * installed with _try1.
+ */
+ typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
+
+#ifndef HAVE_NO_SEH
+ /*
+ * This is not entirely necessary, but it is the structure installed by
+ * the _try1 primitive below.
+ */
+ typedef struct _EXCEPTION_REGISTRATION {
+ struct _EXCEPTION_REGISTRATION *prev;
+ EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
+ } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
+
+ typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
+ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
+#endif
+
+#if (defined(_X86_) && !defined(__x86_64))
#define __try1(pHandler) \
- __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
+ __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
-/*
- * A macro which (despite its name) *removes* an installed
- * exception handler. Should be used only in conjunction with the above
- * install routine __try1.
- * Move the pointer to the old reg. struct (at the current stack
- * position) to fs:0, replacing the pointer we installed above,
- * then add 8 to the stack pointer to get rid of the space we
- * used when we pushed on our new reg. struct above. Notice that
- * the stack must be in the exact state at this point that it was
- * after we did __try1 or this will smash things.
- */
#define __except1 \
- __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
- : : : "%eax");
+ __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
+ : : : "%eax");
+#elif defined(__x86_64)
+#define __try1(pHandler) \
+ __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler));
-#ifdef __cplusplus
+#define __except1 \
+ __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \
+ : : : "%rax");
+#else
+#define __try1(pHandler)
+#define __except1
+#endif
+
+#endif // 0
+
+#ifdef __cplusplus
}
#endif
-#endif /* Not RC_INVOKED */
-
-#endif /* _EXCPT_H_ not defined */
+#pragma pack(pop)
+#endif
diff --git a/reactos/include/crt/fcntl.h b/reactos/include/crt/fcntl.h
index a231484e2e3..fc3b00c2514 100644
--- a/reactos/include/crt/fcntl.h
+++ b/reactos/include/crt/fcntl.h
@@ -3,9 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
-
-#include
+#include
#ifndef _INC_FCNTL
#define _INC_FCNTL
@@ -36,7 +34,6 @@
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
-#define O_ACCMODE _O_ACCMODE
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
@@ -48,5 +45,6 @@
#define O_NOINHERIT _O_NOINHERIT
#define O_SEQUENTIAL _O_SEQUENTIAL
#define O_RANDOM _O_RANDOM
+#define O_ACCMODE _O_ACCMODE
#endif
#endif
diff --git a/reactos/include/crt/float.h b/reactos/include/crt/float.h
index e8bf302cc6a..e0c4704189e 100644
--- a/reactos/include/crt/float.h
+++ b/reactos/include/crt/float.h
@@ -21,8 +21,7 @@
#ifndef _MINGW_FLOAT_H_
#define _MINGW_FLOAT_H_
-/* All the headers include this file. */
-#include <_mingw.h>
+#include
/*
* Functions and definitions for controlling the FPU.
@@ -99,12 +98,12 @@ extern "C" {
/* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
* i.e. change the bits in unMask to have the values they have in unNew,
* leaving other bits unchanged. */
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _controlfp (unsigned int unNew, unsigned int unMask);
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _control87 (unsigned int unNew, unsigned int unMask);
+_CRTIMP unsigned int __cdecl __attribute__ ((__nothrow__)) _controlfp (unsigned int unNew, unsigned int unMask);
+_CRTIMP unsigned int __cdecl __attribute__ ((__nothrow__)) _control87 (unsigned int unNew, unsigned int unMask);
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _clearfp (void); /* Clear the FPU status word */
-_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _statusfp (void); /* Report the FPU status word */
+_CRTIMP unsigned int __cdecl __attribute__ ((__nothrow__)) _clearfp (void); /* Clear the FPU status word */
+_CRTIMP unsigned int __cdecl __attribute__ ((__nothrow__)) _statusfp (void); /* Report the FPU status word */
#define _clear87 _clearfp
#define _status87 _statusfp
@@ -118,11 +117,11 @@ _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _statusfp (void); /* Report the FPU
per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when
building your application.
*/
-void __cdecl __MINGW_NOTHROW _fpreset (void);
-void __cdecl __MINGW_NOTHROW fpreset (void);
+void __cdecl __attribute__ ((__nothrow__)) _fpreset (void);
+void __cdecl __attribute__ ((__nothrow__)) fpreset (void);
/* Global 'variable' for the current floating point error code. */
-_CRTIMP int * __cdecl __MINGW_NOTHROW __fpecode(void);
+_CRTIMP int * __cdecl __attribute__ ((__nothrow__)) __fpecode(void);
#define _fpecode (*(__fpecode()))
/*
@@ -130,15 +129,15 @@ _CRTIMP int * __cdecl __MINGW_NOTHROW __fpecode(void);
* but they really belong in math.h.
*/
-_CRTIMP double __cdecl __MINGW_NOTHROW _chgsign (double);
-_CRTIMP double __cdecl __MINGW_NOTHROW _copysign (double, double);
-_CRTIMP double __cdecl __MINGW_NOTHROW _logb (double);
-_CRTIMP double __cdecl __MINGW_NOTHROW _nextafter (double, double);
-_CRTIMP double __cdecl __MINGW_NOTHROW _scalb (double, long);
+_CRTIMP double __cdecl __attribute__ ((__nothrow__)) _chgsign (double);
+_CRTIMP double __cdecl __attribute__ ((__nothrow__)) _copysign (double, double);
+_CRTIMP double __cdecl __attribute__ ((__nothrow__)) _logb (double);
+_CRTIMP double __cdecl __attribute__ ((__nothrow__)) _nextafter (double, double);
+_CRTIMP double __cdecl __attribute__ ((__nothrow__)) _scalb (double, long);
-_CRTIMP int __cdecl __MINGW_NOTHROW _finite (double);
-_CRTIMP int __cdecl __MINGW_NOTHROW _fpclass (double);
-_CRTIMP int __cdecl __MINGW_NOTHROW _isnan (double);
+_CRTIMP int __cdecl __attribute__ ((__nothrow__)) _finite (double);
+_CRTIMP int __cdecl __attribute__ ((__nothrow__)) _fpclass (double);
+_CRTIMP int __cdecl __attribute__ ((__nothrow__)) _isnan (double);
#ifdef __cplusplus
}
diff --git a/reactos/include/crt/fpieee.h b/reactos/include/crt/fpieee.h
index 67d9fb0e225..74afa77d258 100644
--- a/reactos/include/crt/fpieee.h
+++ b/reactos/include/crt/fpieee.h
@@ -6,7 +6,7 @@
#ifndef _INC_FPIEEE
#define _INC_FPIEEE
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/fvec.h b/reactos/include/crt/fvec.h
index d23fae60a3c..a4c888677ea 100644
--- a/reactos/include/crt/fvec.h
+++ b/reactos/include/crt/fvec.h
@@ -14,7 +14,7 @@
#include
#include
#include
-#include <_mingw.h>
+#include
#if defined(_ENABLE_VEC_DEBUG)
#include
diff --git a/reactos/include/crt/inttypes.h b/reactos/include/crt/inttypes.h
index 1a5b555a82a..2bb3cdea13d 100644
--- a/reactos/include/crt/inttypes.h
+++ b/reactos/include/crt/inttypes.h
@@ -8,7 +8,7 @@
#ifndef _INTTYPES_H_
#define _INTTYPES_H_
-#include <_mingw.h>
+#include
#include
#define __need_wchar_t
#include
diff --git a/reactos/include/crt/io.h b/reactos/include/crt/io.h
index 662397e223f..0accf137df2 100644
--- a/reactos/include/crt/io.h
+++ b/reactos/include/crt/io.h
@@ -1,3 +1,4 @@
+
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
@@ -6,7 +7,7 @@
#ifndef _IO_H_
#define _IO_H_
-#include <_mingw.h>
+#include
#include
#pragma pack(push,_CRT_PACKING)
@@ -25,15 +26,6 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
#ifndef _FINDDATA_T_DEFINED
- struct _finddata32_t {
- unsigned attrib;
- __time32_t time_create;
- __time32_t time_access;
- __time32_t time_write;
- _fsize_t size;
- char name[260];
- };
-
struct _finddata_t {
unsigned attrib;
time_t time_create;
@@ -43,7 +35,25 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
char name[260];
};
-/*#if _INTEGRAL_MAX_BITS >= 64*/
+ struct _finddata32_t {
+ unsigned attrib;
+ __time32_t time_create;
+ __time32_t time_access;
+ __time32_t time_write;
+ _fsize_t size;
+ char name[260];
+ };
+
+#if _INTEGRAL_MAX_BITS >= 64
+
+ struct _finddatai64_t {
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ __int64 size;
+ char name[260];
+ };
struct _finddata32i64_t {
unsigned attrib;
@@ -71,45 +81,13 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
__int64 size;
char name[260];
};
-
- struct _finddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- char name[260];
- };
-
-/* #endif */
-
-#ifdef _WIN64
-//#define _findfirst64i32 _findfirst
-//#define _findnext64i32 _findnext
-//#define _findfirsti64 _findfirst64
-//#define _findnexti64 _findnext64
-
-#else /* !_WIN64 */
-//#define _findfirst32 _findfirst
-//#define _findnext32 _findnext
-//#define _findfirst32i64 _findfirsti64
-//#define _findnext32i64 _findnexti64
-#endif /* !_WIN64 */
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
#define _FINDDATA_T_DEFINED
#endif
#ifndef _WFINDDATA_T_DEFINED
- struct _wfinddata32_t {
- unsigned attrib;
- __time32_t time_create;
- __time32_t time_access;
- __time32_t time_write;
- _fsize_t size;
- wchar_t name[260];
- };
-
struct _wfinddata_t {
unsigned attrib;
time_t time_create;
@@ -119,7 +97,25 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
wchar_t name[260];
};
-/* #if _INTEGRAL_MAX_BITS >= 64 */
+ struct _wfinddata32_t {
+ unsigned attrib;
+ __time32_t time_create;
+ __time32_t time_access;
+ __time32_t time_write;
+ _fsize_t size;
+ wchar_t name[260];
+ };
+
+#if _INTEGRAL_MAX_BITS >= 64
+
+ struct _wfinddatai64_t {
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ __int64 size;
+ wchar_t name[260];
+ };
struct _wfinddata32i64_t {
unsigned attrib;
@@ -147,17 +143,7 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
__int64 size;
wchar_t name[260];
};
-
- struct _wfinddatai64_t {
- unsigned attrib;
- time_t time_create;
- time_t time_access;
- time_t time_write;
- __int64 size;
- wchar_t name[260];
- };
-
-/* #endif */
+#endif
#define _WFINDDATA_T_DEFINED
#endif
@@ -169,60 +155,6 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
#define _A_SUBDIR 0x10
#define _A_ARCH 0x20
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef unsigned int size_t __attribute__ ((mode (DI)));
-#else
- typedef unsigned __int64 size_t;
-#endif
-#else
- typedef unsigned int size_t;
-#endif
-#endif
-
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int ssize_t __attribute__ ((mode (DI)));
-#else
- typedef __int64 ssize_t;
-#endif
-#else
- typedef int ssize_t;
-#endif
-#endif
-
-#ifndef _OFF_T_DEFINED
-#define _OFF_T_DEFINED
-#ifndef _OFF_T_
-#define _OFF_T_
- typedef long _off_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
- typedef long off_t;
-#endif
-#endif
-#endif
-
-#ifndef _OFF64_T_DEFINED
-#define _OFF64_T_DEFINED
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int _off64_t __attribute__ ((mode (DI)));
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
- typedef int off64_t __attribute__ ((mode (DI)));
-#endif
-#else
- typedef long long _off64_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
- typedef long long off64_t;
-#endif
-#endif
-#endif
-
/* Some defines for _access nAccessMode (MS doesn't define them, but
* it doesn't seem to hurt to add them). */
#define F_OK 0 /* Check for file existence */
@@ -248,7 +180,6 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
_CRTIMP int __cdecl _isatty(int _FileHandle);
_CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes);
_CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin);
- _off64_t lseek64(int fd,_off64_t offset, int whence);
_CRTIMP char *__cdecl _mktemp(char *_TemplateName);
_CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode);
_CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount);
@@ -271,11 +202,16 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle);
_CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData);
+ _CRTIMP intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
_CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData);
+ _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData);
+ _CRTIMP int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
+ _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData);
+ _CRTIMP __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin);
+ _CRTIMP __int64 __cdecl _telli64(int _FileHandle);
#ifdef __cplusplus
#include
#endif
- intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
__CRT_INLINE intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData)
{
struct __finddata64_t fd;
@@ -288,9 +224,6 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
strncpy(_FindData->name,fd.name,260);
return ret;
}
- _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData);
- _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData);
- int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
__CRT_INLINE int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData)
{
struct __finddata64_t fd;
@@ -303,11 +236,9 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
strncpy(_FindData->name,fd.name,260);
return ret;
}
- __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin);
- __int64 __cdecl _telli64(int _FileHandle);
#endif
-#ifndef NO_OLDNAMES
+#ifndef NO_OLDNAMES
#ifndef _UWIN
int __cdecl chdir (const char *);
char *__cdecl getcwd (char *, int);
@@ -316,7 +247,6 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
int __cdecl rmdir (const char*);
int __cdecl chmod (const char *, int);
#endif /* _UWIN */
-
#endif /* Not NO_OLDNAMES */
_CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode);
@@ -359,7 +289,7 @@ _CRTIMP char* __cdecl _getcwd (char*, int);
extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0);
#endif
-#endif
+#endif /* !_WIO_DEFINED */
int __cdecl __lock_fhandle(int _Filehandle);
void __cdecl _unlock_fhandle(int _Filehandle);
diff --git a/reactos/include/crt/libgen.h b/reactos/include/crt/libgen.h
index db89e1e14ac..c335d75d165 100644
--- a/reactos/include/crt/libgen.h
+++ b/reactos/include/crt/libgen.h
@@ -14,7 +14,7 @@
#define _LIBGEN_H_
/* All the headers include this file. */
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
diff --git a/reactos/include/crt/limits.h b/reactos/include/crt/limits.h
index fafb04a4696..431f36438fd 100644
--- a/reactos/include/crt/limits.h
+++ b/reactos/include/crt/limits.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_LIMITS
#define _INC_LIMITS
diff --git a/reactos/include/crt/locale.h b/reactos/include/crt/locale.h
index 686aa9bae35..d7ba1077288 100644
--- a/reactos/include/crt/locale.h
+++ b/reactos/include/crt/locale.h
@@ -6,7 +6,7 @@
#ifndef _INC_LOCALE
#define _INC_LOCALE
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/malloc.h b/reactos/include/crt/malloc.h
index 6098b261029..e876d61b1ce 100644
--- a/reactos/include/crt/malloc.h
+++ b/reactos/include/crt/malloc.h
@@ -6,7 +6,7 @@
#ifndef _MALLOC_H_
#define _MALLOC_H_
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
@@ -25,7 +25,7 @@ extern "C" {
#endif
#ifndef _STATIC_ASSERT
-#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)?1:-1]
+#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)]
#endif
/* Return codes for _heapwalk() */
diff --git a/reactos/include/crt/math.h b/reactos/include/crt/math.h
index fd8a3b317d7..da6756f5b7c 100644
--- a/reactos/include/crt/math.h
+++ b/reactos/include/crt/math.h
@@ -3,14 +3,10 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#ifndef _MATH_H_
-#define _MATH_H_
+#ifndef _INC_MATH
+#define _INC_MATH
-#if __GNUC__ >= 3
-#pragma GCC system_header
-#endif
-
-#include <_mingw.h>
+#include
struct exception;
@@ -48,14 +44,7 @@ extern "C" {
#define EDOM 33
#define ERANGE 34
-#ifndef _HUGE
-#ifdef _MSVCRT_
- extern double *_HUGE;
-#else
- extern double *_imp___HUGE;
-#define _HUGE (*_imp___HUGE)
-#endif
-#endif
+ _CRTIMP extern double _HUGE;
#define HUGE_VAL _HUGE
@@ -76,6 +65,7 @@ extern "C" {
double __cdecl cos(double _X);
double __cdecl cosh(double _X);
double __cdecl exp(double _X);
+ double expm1(double _X);
double __cdecl fabs(double _X);
double __cdecl fmod(double _X,double _Y);
double __cdecl log(double _X);
@@ -93,19 +83,19 @@ extern "C" {
#endif
_CRTIMP double __cdecl _cabs(struct _complex _ComplexA);
- double __cdecl ceil(double _X);
- double __cdecl floor(double _X);
- double __cdecl frexp(double _X,int *_Y);
- double __cdecl _hypot(double _X,double _Y);
+ _CRTIMP double __cdecl ceil(double _X);
+ _CRTIMP double __cdecl floor(double _X);
+ _CRTIMP double __cdecl frexp(double _X,int *_Y);
+ _CRTIMP double __cdecl _hypot(double _X,double _Y);
_CRTIMP double __cdecl _j0(double _X);
_CRTIMP double __cdecl _j1(double _X);
_CRTIMP double __cdecl _jn(int _X,double _Y);
- double __cdecl ldexp(double _X,int _Y);
+ _CRTIMP double __cdecl ldexp(double _X,int _Y);
#ifndef _CRT_MATHERR_DEFINED
#define _CRT_MATHERR_DEFINED
int __cdecl _matherr(struct _exception *_Except);
#endif
- double __cdecl modf(double _X,double *_Y);
+ _CRTIMP double __cdecl modf(double _X,double *_Y);
_CRTIMP double __cdecl _y0(double _X);
_CRTIMP double __cdecl _y1(double _X);
_CRTIMP double __cdecl _yn(int _X,double _Y);
@@ -130,6 +120,7 @@ extern "C" {
float __cdecl sinhf(float _X);
float __cdecl tanhf(float _X);
float __cdecl expf(float _X);
+ float expm1f(float _X);
float __cdecl logf(float _X);
float __cdecl log10f(float _X);
float __cdecl modff(float _X,float *_Y);
@@ -421,6 +412,7 @@ extern "C" {
extern long double __cdecl powl (long double, long double);
extern long double __cdecl expl(long double);
+ extern long double expm1l(long double);
extern long double __cdecl coshl(long double);
extern long double __cdecl fabsl (long double);
extern long double __cdecl acosl(long double);
@@ -764,5 +756,4 @@ __fp_unordered_compare (long double x, long double y){
#endif
-#endif /* End _MATH_H_ */
-
+#endif /* !_INC_MATH */
diff --git a/reactos/include/crt/mbctype.h b/reactos/include/crt/mbctype.h
index 39b32651777..f39c66f5bbc 100644
--- a/reactos/include/crt/mbctype.h
+++ b/reactos/include/crt/mbctype.h
@@ -6,7 +6,7 @@
#ifndef _INC_MBCTYPE
#define _INC_MBCTYPE
-#include <_mingw.h>
+#include
#include
#ifdef __cplusplus
@@ -14,16 +14,29 @@ extern "C" {
#endif
/* CRT stuff */
-#if defined(_M_CEE_PURE)
+#if 1
+#if defined (_DLL) && defined (_M_IX86)
/* Retained for compatibility with VC++ 5.0 and earlier versions */
_CRTIMP unsigned char * __cdecl __p__mbctype(void);
_CRTIMP unsigned char * __cdecl __p__mbcasemap(void);
- #define _mbctype (__p__mbctype())
- #define _mbcasemap (__p__mbcasemap())
+#endif /* defined (_DLL) && defined (_M_IX86) */
+#endif
+#ifndef _mbctype
+#ifdef _MSVCRT_
+ extern unsigned char _mbctype[257];
#else
- _CRTIMP extern unsigned char _mbctype[];
- _CRTIMP extern unsigned char _mbcasemap[];
-#endif // defined(_M_CEE_PURE)
+#define _mbctype (*_imp___mbctype)
+ extern unsigned char **_imp___mbctype;
+#endif
+#endif
+#ifndef _mbcasemap
+#ifdef _MSVCRT_
+ extern unsigned char *_mbcasemap;
+#else
+#define _mbcasemap (*_imp___mbcasemap)
+ extern unsigned char **_imp___mbcasemap;
+#endif
+#endif
/* CRT stuff */
#if 1
diff --git a/reactos/include/crt/mbstring.h b/reactos/include/crt/mbstring.h
index d5363b1317c..951bfad43e0 100644
--- a/reactos/include/crt/mbstring.h
+++ b/reactos/include/crt/mbstring.h
@@ -6,7 +6,7 @@
#ifndef _INC_MBSTRING
#define _INC_MBSTRING
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/memory.h b/reactos/include/crt/memory.h
index 90d88aeddf9..b0732953c4d 100644
--- a/reactos/include/crt/memory.h
+++ b/reactos/include/crt/memory.h
@@ -6,7 +6,7 @@
#ifndef _INC_MEMORY
#define _INC_MEMORY
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
diff --git a/reactos/include/crt/new.h b/reactos/include/crt/new.h
index 67e2a0cf0bd..61d58622ada 100644
--- a/reactos/include/crt/new.h
+++ b/reactos/include/crt/new.h
@@ -10,7 +10,7 @@
#include
-#include <_mingw.h>
+#include
#pragma push_macro("new")
#undef new
diff --git a/reactos/include/crt/process.h b/reactos/include/crt/process.h
index dd273edb4ff..a1c001d9ad9 100644
--- a/reactos/include/crt/process.h
+++ b/reactos/include/crt/process.h
@@ -6,7 +6,7 @@
#ifndef _INC_PROCESS
#define _INC_PROCESS
-#include <_mingw.h>
+#include
/* Includes a definition of _pid_t and pid_t */
#include
diff --git a/reactos/include/crt/rtcapi.h b/reactos/include/crt/rtcapi.h
index 17247a7f2f2..9b3c48a3768 100644
--- a/reactos/include/crt/rtcapi.h
+++ b/reactos/include/crt/rtcapi.h
@@ -6,7 +6,7 @@
#ifndef _INC_RTCAPI
#define _INC_RTCAPI
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/search.h b/reactos/include/crt/search.h
index c3be3cf7e68..a58544893d3 100644
--- a/reactos/include/crt/search.h
+++ b/reactos/include/crt/search.h
@@ -6,7 +6,7 @@
#ifndef _INC_SEARCH
#define _INC_SEARCH
-#include <_mingw.h>
+#include
#include
#ifdef __cplusplus
diff --git a/reactos/include/crt/setjmp.h b/reactos/include/crt/setjmp.h
index 8caa5771103..3f56a528f28 100644
--- a/reactos/include/crt/setjmp.h
+++ b/reactos/include/crt/setjmp.h
@@ -6,7 +6,7 @@
#ifndef _INC_SETJMP
#define _INC_SETJMP
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
@@ -130,28 +130,7 @@ extern "C" {
#define _JMP_BUF_DEFINED
#endif
-__CRT_INLINE void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void)
-{
-#ifdef __GNUC__
-#ifdef __x86_64
- __int64 *ret;
- __asm__ __volatile__("leaq 16(%%rsp),%0\n"
- :"=r"(ret)
- :
- );
- return ret;
-#elif __i386__
- __int32 *ret;
- __asm__ __volatile__("lea 8(%esp),%0\n"
- :"=r"(ret)
- :
- );
- return ret;
-#endif
-#else
-#error Unsupported Compiler
-#endif
-}
+ void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void);
#ifdef USE_MINGW_SETJMP_TWO_ARGS
#ifndef _INC_SETJMPEX
diff --git a/reactos/include/crt/share.h b/reactos/include/crt/share.h
index dd7eb60582d..358855fe4a4 100644
--- a/reactos/include/crt/share.h
+++ b/reactos/include/crt/share.h
@@ -10,7 +10,7 @@
#error Only Win32 target is supported!
#endif
-#define _SH_COMPAT 0x00 /* Compatibility */
+#define _SH_COMPAT 0x00
#define _SH_DENYRW 0x10
#define _SH_DENYWR 0x20
#define _SH_DENYRD 0x30
diff --git a/reactos/include/crt/signal.h b/reactos/include/crt/signal.h
index a518f6b311b..8a269971a17 100644
--- a/reactos/include/crt/signal.h
+++ b/reactos/include/crt/signal.h
@@ -6,7 +6,7 @@
#ifndef _INC_SIGNAL
#define _INC_SIGNAL
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
diff --git a/reactos/include/crt/stddef.h b/reactos/include/crt/stddef.h
index 162a3bae4da..02b6d7a9e53 100644
--- a/reactos/include/crt/stddef.h
+++ b/reactos/include/crt/stddef.h
@@ -4,7 +4,7 @@
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_STDDEF
#define _INC_STDDEF
@@ -140,11 +140,11 @@ _TYPE_wchar_t;
#define ___int_ptrdiff_t_h
#define _GCC_PTRDIFF_T
#ifndef __PTRDIFF_TYPE__
-# ifdef _WIN64
- #define __PTRDIFF_TYPE__ long long int
-# else
-# #define __PTRDIFF_TYPE__ long int
-# endif
+#ifdef _WIN64
+#define __PTRDIFF_TYPE__ long long int
+#else
+#define __PTRDIFF_TYPE__ long int
+#endif
#endif
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
@@ -208,11 +208,11 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#define __size_t
#endif
#ifndef __SIZE_TYPE__
-# ifdef _WIN64
-# define __SIZE_TYPE__ long long unsigned int
-# else
-# define __SIZE_TYPE__ long unsigned int
-# endif
+#ifdef _WIN64
+#define __SIZE_TYPE__ long long unsigned int
+#else
+#define __SIZE_TYPE__ long unsigned int
+#endif
#endif
#if !(defined (__GNUG__) && defined (size_t))
typedef __SIZE_TYPE__ size_t;
diff --git a/reactos/include/crt/stdexcpt.h b/reactos/include/crt/stdexcpt.h
index a181ffcecd3..90a242f2635 100644
--- a/reactos/include/crt/stdexcpt.h
+++ b/reactos/include/crt/stdexcpt.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_STDEXCPT
#define _INC_STDEXCPT
diff --git a/reactos/include/crt/stdint.h b/reactos/include/crt/stdint.h
index 14a8bfdc926..30f58bd6071 100644
--- a/reactos/include/crt/stdint.h
+++ b/reactos/include/crt/stdint.h
@@ -25,7 +25,7 @@
#ifndef _STDINT_H
#define _STDINT_H
-#include <_mingw.h>
+#include
#define __need_wint_t
#define __need_wchar_t
diff --git a/reactos/include/crt/stdio.h b/reactos/include/crt/stdio.h
index e22f69f3252..6d688ccc2e4 100644
--- a/reactos/include/crt/stdio.h
+++ b/reactos/include/crt/stdio.h
@@ -6,7 +6,7 @@
#ifndef _INC_STDIO
#define _INC_STDIO
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
@@ -92,7 +92,10 @@ extern "C" {
#ifndef _STDIO_DEFINED
_CRTIMP FILE *__cdecl __iob_func(void);
- _CRTIMP extern FILE _iob[];
+ _CRTDATA(extern FILE _iob[];)
+#ifdef _M_CEE_PURE
+#define _iob __iob_func()
+#endif
#endif
#ifndef _FPOS_T_DEFINED
@@ -110,17 +113,11 @@ extern "C" {
#endif
#ifndef _STDSTREAM_DEFINED
- #define _STDSTREAM_DEFINED
- #ifdef _M_CEE_PURE
- #define stdin (&__iob_func()[0])
- #define stdout (&__iob_func()[1])
- #define stderr (&__iob_func()[2])
- #else // !_M_CEE_PURE
- #define stdin (&_iob[0])
- #define stdout (&_iob[1])
- #define stderr (&_iob[2])
- #endif
-#endif
+#define _STDSTREAM_DEFINED
+#define stdin (&_iob[0])
+#define stdout (&_iob[1])
+#define stderr (&_iob[1])
+#endif /* !_STDSTREAM_DEFINED */
#define _IOREAD 0x0001
#define _IOWRT 0x0002
@@ -134,9 +131,6 @@ extern "C" {
#define _IOERR 0x0020
#define _IOSTRG 0x0040
#define _IORW 0x0080
-#ifdef _POSIX_
-#define _IOAPPEND 0x0200
-#endif
#define _TWO_DIGIT_EXPONENT 0x1
@@ -149,21 +143,21 @@ extern "C" {
#else
_CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag);
#endif
- void __cdecl clearerr(FILE *_File);
- int __cdecl fclose(FILE *_File);
+ _CRTIMP void __cdecl clearerr(FILE *_File);
+ _CRTIMP int __cdecl fclose(FILE *_File);
_CRTIMP int __cdecl _fcloseall(void);
#ifdef _POSIX_
FILE *__cdecl fdopen(int _FileHandle,const char *_Mode);
#else
_CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode);
#endif
- int __cdecl feof(FILE *_File);
- int __cdecl ferror(FILE *_File);
- int __cdecl fflush(FILE *_File);
- int __cdecl fgetc(FILE *_File);
+ _CRTIMP int __cdecl feof(FILE *_File);
+ _CRTIMP int __cdecl ferror(FILE *_File);
+ _CRTIMP int __cdecl fflush(FILE *_File);
+ _CRTIMP int __cdecl fgetc(FILE *_File);
_CRTIMP int __cdecl _fgetchar(void);
- int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos);
- char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File);
+ _CRTIMP int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos);
+ _CRTIMP char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File);
#ifdef _POSIX_
int __cdecl fileno(FILE *_File);
#else
@@ -171,68 +165,61 @@ extern "C" {
#endif
_CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix);
_CRTIMP int __cdecl _flushall(void);
- FILE *__cdecl fopen(const char *_Filename,const char *_Mode);
- FILE *fopen64(const char *filename,const char *mode);
- int __cdecl fprintf(FILE *_File,const char *_Format,...);
- int __cdecl fputc(int _Ch,FILE *_File);
+ _CRTIMP FILE *__cdecl fopen(const char *_Filename,const char *_Mode);
+ _CRTIMP int __cdecl fprintf(FILE *_File,const char *_Format,...);
+ _CRTIMP int __cdecl fputc(int _Ch,FILE *_File);
_CRTIMP int __cdecl _fputchar(int _Ch);
- int __cdecl fputs(const char *_Str,FILE *_File);
- size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File);
- FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File);
- int __cdecl fscanf(FILE *_File,const char *_Format,...);
- int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos);
- int __cdecl fseek(FILE *_File,long _Offset,int _Origin);
- int fseeko64(FILE* stream, _off64_t offset, int whence);
- long __cdecl ftell(FILE *_File);
- _off64_t ftello64(FILE * stream);
- int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
- __int64 __cdecl _ftelli64(FILE *_File);
- size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File);
- int __cdecl getc(FILE *_File);
- int __cdecl getchar(void);
+ _CRTIMP int __cdecl fputs(const char *_Str,FILE *_File);
+ _CRTIMP size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(freopen_s) FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(fscanf_s) int __cdecl fscanf(FILE *_File,const char *_Format,...);
+ _CRTIMP int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos);
+ _CRTIMP int __cdecl fseek(FILE *_File,long _Offset,int _Origin);
+ _CRTIMP long __cdecl ftell(FILE *_File);
+ _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
+ _CRTIMP __int64 __cdecl _ftelli64(FILE *_File);
+ _CRTIMP size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File);
+ _CRTIMP int __cdecl getc(FILE *_File);
+ _CRTIMP int __cdecl getchar(void);
_CRTIMP int __cdecl _getmaxstdio(void);
- char *__cdecl gets(char *_Buffer);
- int __cdecl _getw(FILE *_File);
+ _CRTIMP char *__cdecl gets(char *_Buffer); // FIXME: non-standard
+ _CRTIMP int __cdecl _getw(FILE *_File);
#ifndef _CRT_PERROR_DEFINED
#define _CRT_PERROR_DEFINED
- void __cdecl perror(const char *_ErrMsg);
+ _CRTIMP void __cdecl perror(const char *_ErrMsg);
#endif
_CRTIMP int __cdecl _pclose(FILE *_File);
_CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode);
-#if !defined(NO_OLDNAMES) && !defined(popen)
-#define popen _popen
-#define pclose _pclose
-#endif
- int __cdecl printf(const char *_Format,...);
- int __cdecl putc(int _Ch,FILE *_File);
- int __cdecl putchar(int _Ch);
- int __cdecl puts(const char *_Str);
+ _CRTIMP int __cdecl printf(const char *_Format,...);
+ _CRTIMP int __cdecl putc(int _Ch,FILE *_File);
+ _CRTIMP int __cdecl putchar(int _Ch);
+ _CRTIMP int __cdecl puts(const char *_Str);
_CRTIMP int __cdecl _putw(int _Word,FILE *_File);
#ifndef _CRT_DIRECTORY_DEFINED
#define _CRT_DIRECTORY_DEFINED
- int __cdecl remove(const char *_Filename);
- int __cdecl rename(const char *_OldFilename,const char *_NewFilename);
+ _CRTIMP int __cdecl remove(const char *_Filename);
+ _CRTIMP int __cdecl rename(const char *_OldFilename,const char *_NewFilename);
_CRTIMP int __cdecl _unlink(const char *_Filename);
-#ifndef NO_OLDNAMES
- int __cdecl unlink(const char *_Filename);
+#ifndef NO_OLDNAMES
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_unlink) int __cdecl unlink(const char *_Filename);
#endif
#endif
- void __cdecl rewind(FILE *_File);
+ _CRTIMP void __cdecl rewind(FILE *_File);
_CRTIMP int __cdecl _rmtmp(void);
- int __cdecl scanf(const char *_Format,...);
- void __cdecl setbuf(FILE *_File,char *_Buffer);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(scanf_s) int __cdecl scanf(const char *_Format,...);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(setvbuf) void __cdecl setbuf(FILE *_File,char *_Buffer);
_CRTIMP int __cdecl _setmaxstdio(int _Max);
_CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format);
_CRTIMP unsigned int __cdecl _get_output_format(void);
- int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size);
+ _CRTIMP int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size);
_CRTIMP int __cdecl _scprintf(const char *_Format,...);
- int __cdecl sscanf(const char *_Src,const char *_Format,...);
- _CRTIMP int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...);
- FILE *__cdecl tmpfile(void);
- char *__cdecl tmpnam(char *_Buffer);
- int __cdecl ungetc(int _Ch,FILE *_File);
- int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList);
- int __cdecl vprintf(const char *_Format,va_list _ArgList);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(sscanf_s) int __cdecl sscanf(const char *_Src,const char *_Format,...);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_snscanf_s) int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(tmpfile_s) FILE *__cdecl tmpfile(void);
+ _CRTIMP char *__cdecl tmpnam(char *_Buffer);
+ _CRTIMP_ALT int __cdecl ungetc(int _Ch,FILE *_File);
+ _CRTIMP int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList);
+ _CRTIMP int __cdecl vprintf(const char *_Format,va_list _ArgList);
/* Make sure macros are not defined. */
#if __MINGW_GNUC_PREREQ(4,4)
#pragma push_macro("vsnprintf")
@@ -240,27 +227,13 @@ extern "C" {
#endif
#undef vsnprintf
#undef snprintf
-
- extern
-#ifdef gnu_printf
- __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3)))
-#endif
- int __mingw_vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList);
- extern
-#ifdef gnu_printf
- __attribute__((format(gnu_printf, 3, 4))) __attribute__((nonnull (3)))
-#endif
- int __mingw_snprintf(char* s, size_t n, const char* format, ...);
- int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(vsnprintf_s) int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList);
_CRTIMP int __cdecl _snprintf(char *_Dest,size_t _Count,const char *_Format,...);
_CRTIMP int __cdecl _vsnprintf(char *_Dest,size_t _Count,const char *_Format,va_list _Args);
int __cdecl sprintf(char *_Dest,const char *_Format,...);
int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
int __cdecl snprintf(char* s, size_t n, const char* format, ...);
- __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) {
- return _vsnprintf ( s, n, format, arg);
- }
int __cdecl vscanf(const char * __restrict__ Format, va_list argp);
int __cdecl vfscanf (FILE * __restrict__ fp, const char * Format,va_list argp);
int __cdecl vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp);
@@ -270,26 +243,22 @@ extern "C" {
#pragma pop_macro("snprintf")
#pragma pop_macro("vsnprintf")
#endif
-/* Check if vsnprintf and snprintf are defaulting to gnu-style. */
-#if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF
- #ifndef vsnprint
- #define vsnprintf __mingw_vsnprintf
- #endif
- #ifndef snprintf
- #define snprintf __mingw_snprintf
- #endif
-#else
- #ifndef vsnprint
- #define vsnprintf _vsnprintf
- #endif
- #ifndef snprintf
- #define snprintf _snprintf
- #endif
+
+#ifndef vsnprintf
+ #define vsnprintf _vsnprintf
+#endif
+#ifndef snprintf
+ #define snprintf _snprintf
#endif
_CRTIMP int __cdecl _vscprintf(const char *_Format,va_list _ArgList);
+#ifdef _SAFECRT_IMPL
+#define _set_printf_count_output(i)
+#define _get_printf_count_output() (FALSE)
+#else
_CRTIMP int __cdecl _set_printf_count_output(int _Value);
- _CRTIMP int __cdecl _get_printf_count_output();
+ _CRTIMP int __cdecl _get_printf_count_output(void);
+#endif
#ifndef _WSTDIO_DEFINED
@@ -302,24 +271,24 @@ extern "C" {
#else
_CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag);
#endif
- wint_t __cdecl fgetwc(FILE *_File);
+ _CRTIMP wint_t __cdecl fgetwc(FILE *_File);
_CRTIMP wint_t __cdecl _fgetwchar(void);
- wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
+ _CRTIMP wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
_CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
- wint_t __cdecl getwc(FILE *_File);
- wint_t __cdecl getwchar(void);
- wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
- wint_t __cdecl putwchar(wchar_t _Ch);
- wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
- wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File);
- int __cdecl fputws(const wchar_t *_Str,FILE *_File);
+ _CRTIMP wint_t __cdecl getwc(FILE *_File);
+ _CRTIMP wint_t __cdecl getwchar(void);
+ _CRTIMP wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
+ _CRTIMP wint_t __cdecl putwchar(wchar_t _Ch);
+ _CRTIMP wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
+ _CRTIMP wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File);
+ _CRTIMP int __cdecl fputws(const wchar_t *_Str,FILE *_File);
_CRTIMP wchar_t *__cdecl _getws(wchar_t *_String);
_CRTIMP int __cdecl _putws(const wchar_t *_Str);
- int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...);
- int __cdecl wprintf(const wchar_t *_Format,...);
+ _CRTIMP int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...);
+ _CRTIMP int __cdecl wprintf(const wchar_t *_Format,...);
_CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...);
- int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList);
- int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList);
+ _CRTIMP int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList);
+ _CRTIMP int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList);
_CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...);
_CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list);
_CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...);
@@ -327,18 +296,11 @@ extern "C" {
_CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...);
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
- __CRT_INLINE int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...) {
- int r;
- va_list a;
- __mingw_va_start(a, format);
- r = _vsnwprintf (s, n, format, a);
- __mingw_va_end(a);
- return r;
- }
+ _CRTIMP int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
__CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); }
- int __cdecl vwscanf (const wchar_t *, va_list);
- int __cdecl vfwscanf (FILE *,const wchar_t *,va_list);
- int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list);
+ _CRTIMP int __cdecl vwscanf (const wchar_t *, va_list);
+ _CRTIMP int __cdecl vfwscanf (FILE *,const wchar_t *,va_list);
+ _CRTIMP int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list);
#endif
_CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...);
_CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args);
@@ -347,21 +309,21 @@ extern "C" {
#include
#endif
-//#ifdef _CRT_NON_CONFORMING_SWPRINTFS
-//#ifndef __cplusplus
-//#define swprintf _swprintf
-//#define vswprintf _vswprintf
-//#define _swprintf_l __swprintf_l
-//#define _vswprintf_l __vswprintf_l
-//#endif
-//#endif
+#ifdef _CRT_NON_CONFORMING_SWPRINTFS
+#ifndef __cplusplus
+#define swprintf _swprintf
+#define vswprintf _vswprintf
+#define _swprintf_l __swprintf_l
+#define _vswprintf_l __vswprintf_l
+#endif
+#endif
_CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix);
_CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList);
- int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...);
- int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...);
+ _CRTIMP int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...);
+ _CRTIMP int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...);
_CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...);
- int __cdecl wscanf(const wchar_t *_Format,...);
+ _CRTIMP int __cdecl wscanf(const wchar_t *_Format,...);
_CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode);
_CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode);
_CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile);
diff --git a/reactos/include/crt/stdlib.h b/reactos/include/crt/stdlib.h
index 59a86d9bfb6..206dd69e5f0 100644
--- a/reactos/include/crt/stdlib.h
+++ b/reactos/include/crt/stdlib.h
@@ -6,7 +6,7 @@
#ifndef _INC_STDLIB
#define _INC_STDLIB
-#include <_mingw.h>
+#include
#include
#pragma pack(push,_CRT_PACKING)
@@ -131,7 +131,7 @@ extern "C" {
typedef void (__cdecl *_purecall_handler)(void);
_CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler);
- _CRTIMP _purecall_handler __cdecl _get_purecall_handler();
+ _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void);
typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t);
_invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
@@ -149,15 +149,10 @@ extern "C" {
errno_t __cdecl _set_doserrno(unsigned long _Value);
errno_t __cdecl _get_doserrno(unsigned long *_Value);
-#ifdef _MSVCRT_
- extern int* _imp___sys_nerr;
- extern char*** _imp__sys_errlist;
-#else
- __MINGW_IMPORT int _sys_nerr;
- __MINGW_IMPORT char* _sys_errlist[];
-#endif
+ _CRTIMP extern char *_sys_errlist[];
+ _CRTIMP extern int _sys_nerr;
-//#if (defined(_X86_) && !defined(__x86_64))
+#if (defined(_X86_) || defined(__x86_64)) // HACK
_CRTIMP int *__cdecl __p___argc(void);
_CRTIMP char ***__cdecl __p___argv(void);
_CRTIMP wchar_t ***__cdecl __p___wargv(void);
@@ -165,7 +160,7 @@ extern "C" {
_CRTIMP wchar_t ***__cdecl __p__wenviron(void);
_CRTIMP char **__cdecl __p__pgmptr(void);
_CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
-//#endif
+#endif
#ifndef __argc
#ifdef _MSVCRT_
extern int __argc;
@@ -350,15 +345,15 @@ extern "C" {
void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
#endif
- /*unsigned short __cdecl _byteswap_ushort(unsigned short _Short); */
+ unsigned short __cdecl _byteswap_ushort(unsigned short _Short);
/*unsigned long __cdecl _byteswap_ulong (unsigned long _Long); */
#if _INTEGRAL_MAX_BITS >= 64
- /*unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);*/
+ unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);
#endif
div_t __cdecl div(int _Numerator,int _Denominator);
char *__cdecl getenv(const char *_VarName);
_CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix);
-/* #if _INTEGRAL_MAX_BITS >= 64 */
+#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix);
_CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix);
_CRTIMP __int64 __cdecl _atoi64(const char *_String);
@@ -367,7 +362,7 @@ extern "C" {
_CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
_CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix);
_CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
-/* #endif */
+#endif
ldiv_t __cdecl ldiv(long _Numerator,long _Denominator);
_CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix);
int __cdecl mblen(const char *_Ch,size_t _MaxCount);
@@ -449,7 +444,7 @@ extern "C" {
_CRTIMP long __cdecl _wtol(const wchar_t *_Str);
_CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
-/* #if _INTEGRAL_MAX_BITS >= 64 */
+#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix);
_CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix);
_CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
@@ -458,7 +453,7 @@ extern "C" {
_CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
_CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
_CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
-/* #endif */
+#endif
#endif
#ifndef _POSIX_
@@ -473,8 +468,8 @@ extern "C" {
_CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale);
_CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale);
_CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale);
- _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotl(unsigned long, int) __MINGW_ATTRIB_CONST;
- _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotr(unsigned long, int) __MINGW_ATTRIB_CONST;
+ unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift);
+ unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift);
_CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext);
_onexit_t __cdecl _onexit(_onexit_t _Func);
@@ -483,13 +478,13 @@ extern "C" {
void __cdecl perror(const char *_ErrMsg);
#endif
_CRTIMP int __cdecl _putenv(const char *_EnvString);
- //_CRTIMP unsigned int __cdecl _rotl(unsigned int, int) __MINGW_ATTRIB_CONST;
+ unsigned int __cdecl _rotl(unsigned int _Val,int _Shift);
#if _INTEGRAL_MAX_BITS >= 64
- //_CRTIMP unsigned __int64 __cdecl _rotl64(unsigned __int64, int) __MINGW_ATTRIB_CONST;
+ unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift);
#endif
- //_CRTIMP unsigned int __cdecl _rotr(unsigned int, int) __MINGW_ATTRIB_CONST;
+ unsigned int __cdecl _rotr(unsigned int _Val,int _Shift);
#if _INTEGRAL_MAX_BITS >= 64
- //_CRTIMP unsigned __int64 __cdecl _rotr64(unsigned __int64, int) __MINGW_ATTRIB_CONST;
+ unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift);
#endif
_CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath);
_CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext);
@@ -529,8 +524,8 @@ extern "C" {
#endif
#endif
-#define sys_errlist (*_imp___sys_errlist)
-#define sys_nerr (*_imp___sys_nerr)
+#define sys_errlist _sys_errlist
+#define sys_nerr _sys_nerr
#define environ _environ
char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign);
char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign);
@@ -564,7 +559,7 @@ extern "C" {
char *__cdecl ulltoa (unsigned long long , char *, int);
wchar_t *__cdecl lltow (long long, wchar_t *, int);
wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int);
-#if _INTEGRAL_MAX_BITS >= 64
+
/* __CRT_INLINE using non-ansi functions */
__CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); }
__CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); }
@@ -573,7 +568,7 @@ extern "C" {
__CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); }
__CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); }
#endif /* (__STRICT_ANSI__) */
-#endif
+
#endif /* !__NO_ISOCEXT */
#ifdef __cplusplus
@@ -583,6 +578,4 @@ extern "C" {
#pragma pack(pop)
#include
-#include
-
#endif
diff --git a/reactos/include/crt/string.h b/reactos/include/crt/string.h
index f766137515a..c69a48f6a30 100644
--- a/reactos/include/crt/string.h
+++ b/reactos/include/crt/string.h
@@ -6,7 +6,7 @@
#ifndef _INC_STRING
#define _INC_STRING
-#include <_mingw.h>
+#include
#ifdef __cplusplus
extern "C" {
@@ -25,37 +25,35 @@ extern "C" {
#endif
#endif
-#define _WConst_return _CONST_RETURN
-
#ifndef _CRT_MEMORY_DEFINED
#define _CRT_MEMORY_DEFINED
_CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
- _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
+ _CRTIMP _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
_CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
_CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale);
int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size);
- void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size);
+ _CRT_INSECURE_DEPRECATE_MEMORY(memcpy_s) void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size);
void *__cdecl memset(void *_Dst,int _Val,size_t _Size);
#ifndef NO_OLDNAMES
- void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
- int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_memccpy) void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_memicmp) int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
#endif
#endif
+
char *__cdecl _strset(char *_Str,int _Val);
char *__cdecl strcpy(char *_Dest,const char *_Source);
char *__cdecl strcat(char *_Dest,const char *_Source);
int __cdecl strcmp(const char *_Str1,const char *_Str2);
size_t __cdecl strlen(const char *_Str);
-#if 0
- size_t __cdecl strnlen(const char *_Str,size_t _MaxCount);
-#endif
- void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size);
+ _CRTIMP size_t __cdecl strnlen(const char *_Str,size_t _MaxCount);
+
+ _CRT_INSECURE_DEPRECATE_MEMORY(memmove_s) void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size);
_CRTIMP char *__cdecl _strdup(const char *_Src);
- _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val);
+ _CRTIMP _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val);
_CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2);
_CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2);
_CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
- int __cdecl strcoll(const char *_Str1,const char *_Str2);
+ _CRTIMP int __cdecl strcoll(const char *_Str1,const char *_Str2);
_CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
_CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2);
_CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
@@ -63,9 +61,9 @@ extern "C" {
_CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
_CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount);
_CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
- size_t __cdecl strcspn(const char *_Str,const char *_Control);
- _CRTIMP char *__cdecl _strerror(const char *_ErrMsg);
- char *__cdecl strerror(int);
+ _CRTIMP size_t __cdecl strcspn(const char *_Str,const char *_Control);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_strerror_s) char *__cdecl _strerror(const char *_ErrMsg);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(strerror_s) char *__cdecl strerror(int);
_CRTIMP char *__cdecl _strlwr(char *_String);
char *strlwr_l(char *_String,_locale_t _Locale);
char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count);
@@ -73,67 +71,67 @@ extern "C" {
_CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount);
_CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
char *strncpy(char *_Dest,const char *_Source,size_t _Count);
- _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount);
- _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control);
- _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_strnset_s) char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount);
+ _CRTIMP _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control);
+ _CRTIMP _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch);
_CRTIMP char *__cdecl _strrev(char *_Str);
- size_t __cdecl strspn(const char *_Str,const char *_Control);
- _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr);
- char *__cdecl strtok(char *_Str,const char *_Delim);
+ _CRTIMP size_t __cdecl strspn(const char *_Str,const char *_Control);
+ _CRTIMP _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(strtok_s) char *__cdecl strtok(char *_Str,const char *_Delim);
_CRTIMP char *__cdecl _strupr(char *_String);
_CRTIMP char *_strupr_l(char *_String,_locale_t _Locale);
- size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount);
+ _CRTIMP size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount);
_CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
#ifndef NO_OLDNAMES
- char *__cdecl strdup(const char *_Src);
- int __cdecl strcmpi(const char *_Str1,const char *_Str2);
- int __cdecl stricmp(const char *_Str1,const char *_Str2);
- char *__cdecl strlwr(char *_Str);
- int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount);
- __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); }
- __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); }
- char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount);
- char *__cdecl strrev(char *_Str);
- char *__cdecl strset(char *_Str,int _Val);
- char *__cdecl strupr(char *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strdup) char *__cdecl strdup(const char *_Src);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strcmpi) int __cdecl strcmpi(const char *_Str1,const char *_Str2);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_stricmp) int __cdecl stricmp(const char *_Str1,const char *_Str2);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strlwr) char *__cdecl strlwr(char *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strnicmp) int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount);
+// __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); }
+// __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); }
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strnset) char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strrev) char *__cdecl strrev(char *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strset) char *__cdecl strset(char *_Str,int _Val);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_strupr) char *__cdecl strupr(char *_Str);
#endif
#ifndef _WSTRING_DEFINED
#define _WSTRING_DEFINED
_CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str);
- wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source);
- _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
- int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2);
- wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source);
- size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control);
- size_t __cdecl wcslen(const wchar_t *_Str);
- size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount);
- wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
- int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
- wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
- _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control);
- _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
- size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);
- _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr);
- wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim);
- _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum);
- _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str);
+ _CRTIMP wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source);
+ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
+ _CRTIMP int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2);
+ _CRTIMP wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source);
+ _CRTIMP size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control);
+ _CRTIMP size_t __cdecl wcslen(const wchar_t *_Str);
+ _CRTIMP size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount);
+ _CRTIMP wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
+ _CRTIMP int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
+ _CRTIMP wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
+ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control);
+ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
+ _CRTIMP size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);
+ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(wcstok_s) wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_wcserror_s) wchar_t *__cdecl _wcserror(int _ErrNum);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(__wcserror_s) wchar_t *__cdecl __wcserror(const wchar_t *_Str);
_CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
_CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
_CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
_CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
- _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_wcsnset_s) wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
_CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str);
- _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val);
+ _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_wcsset_s) wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val);
_CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String);
_CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale);
_CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String);
_CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale);
- size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount);
+ _CRTIMP size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount);
_CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale);
- int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2);
+ _CRTIMP int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2);
_CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
_CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2);
_CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
@@ -143,27 +141,30 @@ extern "C" {
_CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
#ifndef NO_OLDNAMES
- /* NOTE: There is no _wcscmpi, but this is for compatibility. */
- int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2);
- __CRT_INLINE int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) { return _wcsicmp (__ws1, __ws2); }
- #define _wcscmpi _wcsicmp
-
- wchar_t *__cdecl wcsdup(const wchar_t *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsdup) wchar_t *__cdecl wcsdup(const wchar_t *_Str);
#define wcswcs wcsstr
- int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
- int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
- wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
- wchar_t *__cdecl wcsrev(wchar_t *_Str);
- wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val);
- wchar_t *__cdecl wcslwr(wchar_t *_Str);
- wchar_t *__cdecl wcsupr(wchar_t *_Str);
- int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2);
-#endif
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsicmp) int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsnicmp) int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsnset) wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsrev) wchar_t *__cdecl wcsrev(wchar_t *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsset) wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcslwr) wchar_t *__cdecl wcslwr(wchar_t *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsupr) wchar_t *__cdecl wcsupr(wchar_t *_Str);
+ _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsicoll) int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2);
#endif
+#endif /* !_WSTRING_DEFINED */
+
#ifdef __cplusplus
}
#endif
#include
+
+// HACK
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#define stricmp _stricmp
+#define wcsicmp _wcsicmp
+
#endif
diff --git a/reactos/include/crt/sys/locking.h b/reactos/include/crt/sys/locking.h
index e3fc85b3a7b..1e58241afd7 100644
--- a/reactos/include/crt/sys/locking.h
+++ b/reactos/include/crt/sys/locking.h
@@ -10,8 +10,7 @@
#error Only Win32 target is supported!
#endif
-/* All the headers include this file. */
-#include <_mingw.h>
+#include
#define _LK_UNLCK 0
#define _LK_LOCK 1
diff --git a/reactos/include/crt/sys/stat.h b/reactos/include/crt/sys/stat.h
index f8f280c7037..22bfb0f32c7 100644
--- a/reactos/include/crt/sys/stat.h
+++ b/reactos/include/crt/sys/stat.h
@@ -10,8 +10,7 @@
#error Only Win32 target is supported!
#endif
-#include <_mingw.h>
-#include
+#include
#pragma pack(push,_CRT_PACKING)
@@ -19,49 +18,10 @@
extern "C" {
#endif
-#ifndef _CRTIMP
-#define _CRTIMP __declspec(dllimport)
-#endif
-
#include
-#ifdef _USE_32BIT_TIME_T
-#ifdef _WIN64
-#undef _USE_32BIT_TIME_T
-#endif
-#else
-#if _INTEGRAL_MAX_BITS < 64
-#define _USE_32BIT_TIME_T
-#endif
-#endif
-
-#ifndef _TIME32_T_DEFINED
- typedef long __time32_t;
-#define _TIME32_T_DEFINED
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#if _INTEGRAL_MAX_BITS >= 64
- typedef __int64 __time64_t;
-#endif
-#define _TIME64_T_DEFINED
-#endif
-
-#ifndef _TIME_T_DEFINED
-#ifdef _USE_32BIT_TIME_T
- typedef __time32_t time_t;
-#else
- typedef __time64_t time_t;
-#endif
-#define _TIME_T_DEFINED
-#endif
-
-#ifndef _WCHAR_T_DEFINED
- typedef unsigned short wchar_t;
-#define _WCHAR_T_DEFINED
-#endif
-
#ifndef _STAT_DEFINED
+#define _STAT_DEFINED
struct _stat32 {
_dev_t st_dev;
@@ -107,8 +67,7 @@ extern "C" {
};
#endif
-/* #if _INTEGRAL_MAX_BITS >= 64 */
-
+#if _INTEGRAL_MAX_BITS >= 64
struct _stat32i64 {
_dev_t st_dev;
_ino_t st_ino;
@@ -165,11 +124,10 @@ extern "C" {
time_t st_ctime;
};
-/* #endif */
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
#define __stat64 _stat64
-#define _STAT_DEFINED
#endif /* !_STAT_DEFINED */
#define _S_IFMT 0xF000
@@ -189,52 +147,16 @@ extern "C" {
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat);
_CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat);
- int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
- __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat)
- {
- struct _stat64 st;
- int ret=_fstat64(_FileDes,&st);
- _Stat->st_dev=st.st_dev;
- _Stat->st_ino=st.st_ino;
- _Stat->st_mode=st.st_mode;
- _Stat->st_nlink=st.st_nlink;
- _Stat->st_uid=st.st_uid;
- _Stat->st_gid=st.st_gid;
- _Stat->st_rdev=st.st_rdev;
- _Stat->st_size=(_off_t) st.st_size;
- _Stat->st_atime=st.st_atime;
- _Stat->st_mtime=st.st_mtime;
- _Stat->st_ctime=st.st_ctime;
- return ret;
- }
-
+ _CRTIMP int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
_CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat);
_CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
- int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
- __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
- {
- struct _stat64 st;
- int ret=_stat64(_Name,&st);
- _Stat->st_dev=st.st_dev;
- _Stat->st_ino=st.st_ino;
- _Stat->st_mode=st.st_mode;
- _Stat->st_nlink=st.st_nlink;
- _Stat->st_uid=st.st_uid;
- _Stat->st_gid=st.st_gid;
- _Stat->st_rdev=st.st_rdev;
- _Stat->st_size=(_off_t) st.st_size;
- _Stat->st_atime=st.st_atime;
- _Stat->st_mtime=st.st_mtime;
- _Stat->st_ctime=st.st_ctime;
- return ret;
- }
-#endif
+ _CRTIMP int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
+#endif /* _INTEGRAL_MAX_BITS >= 64 */
#ifndef _WSTAT_DEFINED
#define _WSTAT_DEFINED
_CRTIMP int __cdecl _wstat(const wchar_t *_Name,struct _stat *_Stat);
_CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat);
- _CRTIMP int __cdecl _wstati64(const wchar_t *_Name,struct _stati64 *_Stat);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat);
_CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);
@@ -242,6 +164,55 @@ extern "C" {
#endif
#endif
+
+/** Compatibility definitons *************************************************/
+
+#if !defined(RC_INVOKED)
+
+#ifdef _USE_32BIT_TIME_T
+ #define _fstat32 _fstat
+ #define _fstat32i64 _fstati64
+ #define _fstat64i32 _fstat64
+#else
+ #define _fstat64i32 _fstat
+ __CRT_INLINE int __cdecl _fstat32(int _FileDes, struct _stat32 *_Stat)
+ {
+ struct _stat _Stat64;
+ int ret = _fstat(_FileDes, &_Stat64);
+ _Stat->st_dev = _Stat64.st_dev;
+ _Stat->st_ino = _Stat64.st_ino;
+ _Stat->st_mode = _Stat64.st_mode;
+ _Stat->st_nlink = _Stat64.st_nlink;
+ _Stat->st_uid = _Stat64.st_uid;
+ _Stat->st_gid = _Stat64.st_gid;
+ _Stat->st_rdev = _Stat64.st_rdev;
+ _Stat->st_size = _Stat64.st_size;
+ _Stat->st_atime = _Stat64.st_atime;
+ _Stat->st_mtime = _Stat64.st_mtime;
+ _Stat->st_ctime = _Stat64.st_ctime;
+ return ret;
+ }
+ __CRT_INLINE int __cdecl _fstat32i64(int _FileDes, struct _stat32i64 *_Stat)
+ {
+ struct _stat64 _Stat64;
+ int ret = _fstat64(_FileDes, &_Stat64);
+ _Stat->st_dev = _Stat64.st_dev;
+ _Stat->st_ino = _Stat64.st_ino;
+ _Stat->st_mode = _Stat64.st_mode;
+ _Stat->st_nlink = _Stat64.st_nlink;
+ _Stat->st_uid = _Stat64.st_uid;
+ _Stat->st_gid = _Stat64.st_gid;
+ _Stat->st_rdev = _Stat64.st_rdev;
+ _Stat->st_size = _Stat64.st_size;
+ _Stat->st_atime = _Stat64.st_atime;
+ _Stat->st_mtime = _Stat64.st_mtime;
+ _Stat->st_ctime = _Stat64.st_ctime;
+ return ret;
+ }
+#endif /* _USE_32BIT_TIME_T */
+
+#endif /* !defined(RC_INVOKED) */
+
#ifndef NO_OLDNAMES
#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
@@ -271,13 +242,10 @@ extern "C" {
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-
-#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
-int __cdecl stat(const char *_Filename,struct stat *_Stat);
-int __cdecl fstat(int _Desc,struct stat *_Stat);
-int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
-
+#if !defined (RC_INVOKED)
+ _CRTIMP int __cdecl stat(const char *_Filename,struct stat *_Stat);
+ _CRTIMP int __cdecl fstat(int _Desc,struct stat *_Stat);
+ _CRTIMP int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) {
return _fstat(_Desc,(struct _stat *)_Stat);
}
@@ -292,6 +260,9 @@ __CRT_INLINE int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat) {
#endif
+#endif /* !NO_OLDNAMES */
+
+
#ifdef __cplusplus
}
#endif
diff --git a/reactos/include/crt/sys/timeb.h b/reactos/include/crt/sys/timeb.h
index 1cf3ce8b3ee..574c9704f27 100644
--- a/reactos/include/crt/sys/timeb.h
+++ b/reactos/include/crt/sys/timeb.h
@@ -3,10 +3,10 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#ifndef _TIMEB_H_
-#define _TIMEB_H_
+#ifndef _INC_TIMEB
+#define _INC_TIMEB
-#include <_mingw.h>
+#include
#ifndef _WIN32
#error Only Win32 target is supported!
@@ -18,44 +18,16 @@
extern "C" {
#endif
-#ifndef _CRTIMP
-#define _CRTIMP __declspec(dllimport)
-#endif
-
-#ifdef _USE_32BIT_TIME_T
-#ifdef _WIN64
-#undef _USE_32BIT_TIME_T
-#endif
-#else
-#if _INTEGRAL_MAX_BITS < 64
-#define _USE_32BIT_TIME_T
-#endif
-#endif
-
-#ifndef _TIME32_T_DEFINED
- typedef long __time32_t;
-#define _TIME32_T_DEFINED
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#if _INTEGRAL_MAX_BITS >= 64
- typedef __int64 __time64_t;
-#endif
-#define _TIME64_T_DEFINED
-#endif
-
-#ifndef _TIME_T_DEFINED
-#ifdef _USE_32BIT_TIME_T
- typedef __time32_t time_t;
-#else
- typedef __time64_t time_t;
-#endif
-#define _TIME_T_DEFINED
-#endif
-
#ifndef _TIMEB_DEFINED
#define _TIMEB_DEFINED
+ struct _timeb {
+ time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+ };
+
struct __timeb32 {
__time32_t time;
unsigned short millitm;
@@ -81,41 +53,20 @@ extern "C" {
};
#endif
-#ifdef _USE_32BIT_TIME_T
-#define _timeb __timeb32
-#define _ftime _ftime32
-#else
-#define _timeb __timeb64
-#define _ftime _ftime64
-#endif
-#endif
+#endif /* !_TIMEB_DEFINED */
- _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time);
+ _CRTIMP void __cdecl _ftime(struct _timeb *_Time);
+ _CRT_INSECURE_DEPRECATE(_ftime32_s) _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time);
+ _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time);
#if _INTEGRAL_MAX_BITS >= 64
- _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time);
+ _CRT_INSECURE_DEPRECATE(_ftime64_s) _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time);
+ _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time);
#endif
-#ifndef TIMESPEC_DEFINED
-#define TIMESPEC_DEFINED
-struct timespec {
- time_t tv_sec; /* Seconds */
- long tv_nsec; /* Nanoseconds */
-};
-
-struct itimerspec {
- struct timespec it_interval; /* Timer period */
- struct timespec it_value; /* Timer expiration */
-};
-#endif
-
-#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
-#ifdef _USE_32BIT_TIME_T
+#ifndef NO_OLDNAMES
+#if !defined (RC_INVOKED)
__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
- _ftime32((struct __timeb32 *)_Tmb);
-}
-#else
-__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
- _ftime64((struct __timeb64 *)_Tmb);
+ _ftime((struct _timeb *)_Tmb);
}
#endif
#endif
@@ -127,4 +78,5 @@ __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
#pragma pack(pop)
#include
-#endif
+
+#endif /* !_INC_TIMEB */
diff --git a/reactos/include/crt/sys/types.h b/reactos/include/crt/sys/types.h
index 5b474927af2..8ba3df7e7da 100644
--- a/reactos/include/crt/sys/types.h
+++ b/reactos/include/crt/sys/types.h
@@ -10,38 +10,7 @@
#error Only Win32 target is supported!
#endif
-#include <_mingw.h>
-
-#ifdef _USE_32BIT_TIME_T
-#ifdef _WIN64
-#undef _USE_32BIT_TIME_T
-#endif
-#else
-#if _INTEGRAL_MAX_BITS < 64
-#define _USE_32BIT_TIME_T
-#endif
-#endif
-
-#ifndef _TIME32_T_DEFINED
-#define _TIME32_T_DEFINED
-typedef long __time32_t;
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#define _TIME64_T_DEFINED
-#if _INTEGRAL_MAX_BITS >= 64
-typedef __int64 __time64_t;
-#endif
-#endif
-
-#ifndef _TIME_T_DEFINED
-#define _TIME_T_DEFINED
-#ifdef _USE_32BIT_TIME_T
-typedef __time32_t time_t;
-#else
-typedef __time64_t time_t;
-#endif
-#endif
+#include
#ifndef _INO_T_DEFINED
#define _INO_T_DEFINED
@@ -59,58 +28,12 @@ typedef unsigned int dev_t;
#endif
#endif
-#ifndef _PID_T_
-#define _PID_T_
-#ifndef _WIN64
-typedef int _pid_t;
-#else
-typedef __int64 _pid_t;
-#endif
-
-#ifndef NO_OLDNAMES
-typedef _pid_t pid_t;
-#endif
-#endif /* Not _PID_T_ */
-
-#ifndef _MODE_T_
-#define _MODE_T_
-typedef unsigned short _mode_t;
-
-#ifndef NO_OLDNAMES
-typedef _mode_t mode_t;
-#endif
-#endif /* Not _MODE_T_ */
-
#ifndef _OFF_T_DEFINED
#define _OFF_T_DEFINED
-#ifndef _OFF_T_
-#define _OFF_T_
typedef long _off_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
+# ifndef NO_OLDNAMES
typedef long off_t;
-#endif
-#endif
+# endif
#endif
-#ifndef _OFF64_T_DEFINED
-#define _OFF64_T_DEFINED
- typedef long long _off64_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
- typedef long long off64_t;
-#endif
-#endif
-
-#ifndef TIMESPEC_DEFINED
-#define TIMESPEC_DEFINED
-struct timespec {
- time_t tv_sec; /* Seconds */
- long tv_nsec; /* Nanoseconds */
-};
-
-struct itimerspec {
- struct timespec it_interval; /* Timer period */
- struct timespec it_value; /* Timer expiration */
-};
-#endif
-
-#endif
+#endif /* !_INC_TYPES */
diff --git a/reactos/include/crt/sys/utime.h b/reactos/include/crt/sys/utime.h
index 5b094156e2e..13925ec87fb 100644
--- a/reactos/include/crt/sys/utime.h
+++ b/reactos/include/crt/sys/utime.h
@@ -10,7 +10,7 @@
#error Only Win32 target is supported!
#endif
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
@@ -18,46 +18,6 @@
extern "C" {
#endif
-#ifndef _CRTIMP
-#define _CRTIMP __declspec(dllimport)
-#endif
-
-#ifndef _WCHAR_T_DEFINED
- typedef unsigned short wchar_t;
-#define _WCHAR_T_DEFINED
-#endif
-
-#ifdef _USE_32BIT_TIME_T
-#ifdef _WIN64
-#undef _USE_32BIT_TIME_T
-#endif
-#else
-#if _INTEGRAL_MAX_BITS < 64
-#define _USE_32BIT_TIME_T
-#endif
-#endif
-
-#ifndef _TIME32_T_DEFINED
-#define _TIME32_T_DEFINED
- typedef long __time32_t;
-#endif
-
-#ifndef _TIME64_T_DEFINED
-#define _TIME64_T_DEFINED
-#if _INTEGRAL_MAX_BITS >= 64
- typedef __int64 __time64_t;
-#endif
-#endif
-
-#ifndef _TIME_T_DEFINED
-#define _TIME_T_DEFINED
-#ifdef _USE_32BIT_TIME_T
- typedef __time32_t time_t;
-#else
- typedef __time64_t time_t;
-#endif
-#endif
-
#ifndef _UTIMBUF_DEFINED
#define _UTIMBUF_DEFINED
@@ -89,13 +49,13 @@ extern "C" {
__time32_t modtime;
};
#endif
-#endif
+#endif /* !_UTIMBUF_DEFINED */
- _CRTIMP int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf);
+ _CRTIMP int __cdecl _utime(const char *_Filename,struct _utimbuf *_Time);
_CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time);
- _CRTIMP int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf);
+ _CRTIMP int __cdecl _futime(int _FileDes,struct _utimbuf *_Time);
_CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time);
- _CRTIMP int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf);
+ _CRTIMP int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Time);
_CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time);
@@ -103,38 +63,25 @@ extern "C" {
_CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time);
#endif
-// Do it like this to keep compatibility to MSVC while using msvcrt.dll
#ifndef RC_INVOKED
- #ifdef _USE_32BIT_TIME_T
- __CRT_INLINE int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Utimbuf) {
- return _utime(_Filename,(struct _utimbuf *)_Utimbuf);
- }
- __CRT_INLINE int __cdecl _futime32(int _Desc,struct __utimbuf32 *_Utimbuf) {
- return _futime(_Desc,(struct _utimbuf *)_Utimbuf);
- }
- __CRT_INLINE int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Utimbuf) {
- return _wutime(_Filename,(struct _utimbuf *)_Utimbuf);
- }
- #else // !_USE_32BIT_TIME_T
- #ifndef _WIN64
- __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) {
- return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf);
- }
- __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) {
- return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf);
- }
- __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) {
- return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf);
- }
- #endif
- #endif // _USE_32BIT_TIME_T
-#endif // RC_INVOKED
+#ifdef _USE_32BIT_TIME_T
+__CRT_INLINE int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Utimbuf) {
+ return _utime(_Filename,(struct _utimbuf *)_Utimbuf);
+}
+__CRT_INLINE int __cdecl _futime32(int _Desc,struct __utimbuf32 *_Utimbuf) {
+ return _futime(_Desc,(struct _utimbuf *)_Utimbuf);
+}
+__CRT_INLINE int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Utimbuf) {
+ return _wutime(_Filename,(struct _utimbuf *)_Utimbuf);
+}
+#endif
#ifndef NO_OLDNAMES
__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) {
return _utime(_Filename,(struct _utimbuf *)_Utimbuf);
}
#endif
+#endif
#ifdef __cplusplus
}
diff --git a/reactos/include/crt/tchar.h b/reactos/include/crt/tchar.h
index 08c6c1ca3a5..b047e3aa06e 100644
--- a/reactos/include/crt/tchar.h
+++ b/reactos/include/crt/tchar.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_TCHAR
#define _INC_TCHAR
@@ -79,12 +79,14 @@ extern "C" {
#define _WConst_return _CONST_RETURN
-#ifdef _UNICODE
-
#ifdef __cplusplus
}
#endif
+
+#ifdef _UNICODE
+/** UNICODE ******************************************************************/
+
#include
#ifdef __cplusplus
@@ -479,10 +481,7 @@ extern "C" {
#define _tseekdir _wseekdir
#else
-
-#ifdef __cplusplus
-}
-#endif
+/** ANSI *********************************************************************/
#include
@@ -753,6 +752,7 @@ extern "C" {
#define _tsetlocale setlocale
#ifdef _MBCS
+/** MBCS *********************************************************************/
#ifdef __cplusplus
}
@@ -851,7 +851,9 @@ extern "C" {
#define _tclen _mbclen
#define _tccpy _mbccpy
#define _tccpy_l _mbccpy_l
-#else
+
+
+#else /* !_MB_MAP_DIRECT */
_CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val);
_CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control);
@@ -957,7 +959,9 @@ extern "C" {
#define _istlead _ismbblead
#define _istleadbyte isleadbyte
#define _istleadbyte_l _isleadbyte_l
-#else
+
+#else /* !_MBCS */
+/** SBCS *********************************************************************/
#ifndef __TCHAR_DEFINED
#define __TCHAR_DEFINED
@@ -1106,8 +1110,10 @@ extern "C" {
#define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters))
#define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count))
#define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value))
-#endif
-#endif
+
+#endif /* !_MBCS */
+#endif /* !UNICODE */
+/*****************************************************************************/
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
diff --git a/reactos/include/crt/time.h b/reactos/include/crt/time.h
index 38f8c1893d1..d714fa62590 100644
--- a/reactos/include/crt/time.h
+++ b/reactos/include/crt/time.h
@@ -6,7 +6,7 @@
#ifndef _TIME_H_
#define _TIME_H_
-#include <_mingw.h>
+#include
#ifndef _WIN32
#error Only Win32 target is supported!
@@ -18,15 +18,6 @@
extern "C" {
#endif
-#ifndef _CRTIMP
-#define _CRTIMP __declspec(dllimport)
-#endif
-
-#ifndef _WCHAR_T_DEFINED
-#define _WCHAR_T_DEFINED
- typedef unsigned short wchar_t;
-#endif
-
#ifndef _TIME32_T_DEFINED
#define _TIME32_T_DEFINED
typedef long __time32_t;
@@ -71,20 +62,6 @@ extern "C" {
#endif
#endif
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-#if defined(__GNUC__) && defined(__STRICT_ANSI__)
- typedef int ssize_t __attribute__ ((mode (DI)));
-#else
- typedef __int64 ssize_t;
-#endif
-#else
- typedef int ssize_t;
-#endif
-#endif
-
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
@@ -93,17 +70,6 @@ extern "C" {
#endif
#endif
-/*
-#ifdef _USE_32BIT_TIME_T
-#define _localtime32 localtime
-#define _difftime32 difftime
-#define _ctime32 ctime
-#define _gmtime32 gmtime
-#define _mktime32 mktime
-#define _time32 time
-#endif
-*/
-
#ifndef _TM_DEFINED
#define _TM_DEFINED
struct tm {
@@ -121,79 +87,97 @@ extern "C" {
#define CLOCKS_PER_SEC 1000
- __MINGW_IMPORT int _daylight;
- __MINGW_IMPORT long _dstbias;
- __MINGW_IMPORT long _timezone;
- __MINGW_IMPORT char * _tzname[2];
+ _CRTDATA(extern int _daylight);
+ _CRTDATA(extern long _dstbias);
+ _CRTDATA(extern long _timezone);
+ _CRTDATA(extern char * _tzname[2]);
_CRTIMP errno_t __cdecl _get_daylight(int *_Daylight);
_CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias);
_CRTIMP errno_t __cdecl _get_timezone(long *_Timezone);
_CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index);
- char *__cdecl asctime(const struct tm *_Tm);
- _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time);
- clock_t __cdecl clock(void);
+
+ _CRTIMP _CRT_INSECURE_DEPRECATE(asctime_s) char *__cdecl asctime(const struct tm *_Tm);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_ctime32_s) char *__cdecl _ctime32(const __time32_t *_Time);
+ _CRTIMP clock_t __cdecl clock(void);
_CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2);
- _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time);
- _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time);
- size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_gmtime32_s) struct tm *__cdecl _gmtime32(const __time32_t *_Time);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_localtime32_s) struct tm *__cdecl _localtime32(const __time32_t *_Time);
+ _CRTIMP size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm);
_CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale);
_CRTIMP char *__cdecl _strdate(char *_Buffer);
_CRTIMP char *__cdecl _strtime(char *_Buffer);
_CRTIMP __time32_t __cdecl _time32(__time32_t *_Time);
_CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm);
_CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm);
-#if defined (_POSIX_) || defined(__GNUC__)
- void __cdecl tzset(void);
-#endif
_CRTIMP void __cdecl _tzset(void);
+ _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _getsystime(struct tm *_Tm);
+ _CRT_OBSOLETE(GetLocalTime) unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec);
+
+ _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time);
+ _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time);
+ _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time);
+ _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes);
+ _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes);
#if _INTEGRAL_MAX_BITS >= 64
- double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2);
- _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time);
- _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time);
- _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time);
+ _CRTIMP double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_ctime64_s) char *__cdecl _ctime64(const __time64_t *_Time);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_gmtime64_s) struct tm *__cdecl _gmtime64(const __time64_t *_Time);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_localtime64_s) struct tm *__cdecl _localtime64(const __time64_t *_Time);
_CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm);
_CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm);
_CRTIMP __time64_t __cdecl _time64(__time64_t *_Time);
+
+ _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time);
+ _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time);
+ _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time);
#endif
- unsigned __cdecl _getsystime(struct tm *_Tm);
- unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec);
#ifndef _WTIME_DEFINED
- _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm);
- _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time);
- size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm);
+#define _WTIME_DEFINED
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_wasctime_s) wchar_t *__cdecl _wasctime(const struct tm *_Tm);
+ _CRTIMP wchar_t *__cdecl _wctime(const time_t *_Time);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_wctime32_s) wchar_t *__cdecl _wctime32(const __time32_t *_Time);
+ _CRTIMP size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm);
_CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale);
_CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer);
_CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer);
+
+ _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm);
+ _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time);
+ _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords);
+ _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords);
#if _INTEGRAL_MAX_BITS >= 64
- _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time);
+ _CRTIMP _CRT_INSECURE_DEPRECATE(_wctime64_s) wchar_t *__cdecl _wctime64(const __time64_t *_Time);
+ _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time);
#endif
#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL)
#define _INC_WTIME_INL
#ifdef _USE_32BIT_TIME_T
-__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); }
+/* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */
+__CRT_INLINE wchar_t *__cdecl _wctime32(const time_t *_Time) { return _wctime(_Time); }
+__CRT_INLINE errno_t _wctime32_s(wchar_t *_Buffer, size_t _SizeInWords,const __time32_t *_Time) { return _wctime32_s(_Buffer, _SizeInWords, _Time); }
#else
__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
+__CRT_INLINE errno_t _wctime_s(wchar_t *_Buffer, size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer, _SizeInWords, _Time); }
#endif
#endif
-#define _WTIME_DEFINED
-#endif
+#endif /* !_WTIME_DEFINED */
+
+ _CRTIMP double __cdecl difftime(time_t _Time1,time_t _Time2);
+ _CRTIMP char *__cdecl ctime(const time_t *_Time);
+ _CRTIMP struct tm *__cdecl gmtime(const time_t *_Time);
+ _CRTIMP struct tm *__cdecl localtime(const time_t *_Time);
+ _CRTIMP struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *);
+
+ _CRTIMP time_t __cdecl mktime(struct tm *_Tm);
+ _CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm);
+ _CRTIMP time_t __cdecl time(time_t *_Time);
#ifndef RC_INVOKED
-double __cdecl difftime(time_t _Time1,time_t _Time2);
-char *__cdecl ctime(const time_t *_Time);
-struct tm *__cdecl gmtime(const time_t *_Time);
-struct tm *__cdecl localtime(const time_t *_Time);
-struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *);
-
-_CRTIMP time_t __cdecl mktime(struct tm *_Tm);
-_CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm);
-_CRTIMP time_t __cdecl time(time_t *_Time);
-
#ifdef _USE_32BIT_TIME_T
#if 0
__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); }
@@ -224,17 +208,6 @@ __CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); }
void __cdecl tzset(void);
#endif
-#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */
-#define _TIMEVAL_DEFINED
-struct timeval {
- long tv_sec;
- long tv_usec;
-};
-#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
-#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
-#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
-#endif /* _TIMEVAL_DEFINED */
-
#ifdef __cplusplus
}
#endif
@@ -243,8 +216,5 @@ struct timeval {
#include
-/* Adding timespec definition. */
-#include
-
#endif /* End _TIME_H_ */
diff --git a/reactos/include/crt/typeinfo.h b/reactos/include/crt/typeinfo.h
index 68c25bdda76..e7bd1187266 100644
--- a/reactos/include/crt/typeinfo.h
+++ b/reactos/include/crt/typeinfo.h
@@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
-#include <_mingw.h>
+#include
#ifndef _INC_TYPEINFO
#define _INC_TYPEINFO
diff --git a/reactos/include/crt/vadefs.h b/reactos/include/crt/vadefs.h
index eae1a2e5764..eda88961977 100644
--- a/reactos/include/crt/vadefs.h
+++ b/reactos/include/crt/vadefs.h
@@ -10,7 +10,7 @@
#error Only Win32 target is supported!
#endif
-#include <_mingw.h>
+#include
#undef _CRT_PACKING
#define _CRT_PACKING 8
diff --git a/reactos/include/crt/wchar.h b/reactos/include/crt/wchar.h
index 7eef039fe2c..4e0cd7c8756 100644
--- a/reactos/include/crt/wchar.h
+++ b/reactos/include/crt/wchar.h
@@ -6,7 +6,7 @@
#ifndef _INC_WCHAR
#define _INC_WCHAR
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
@@ -21,16 +21,6 @@ extern "C" {
#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
#endif
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
- typedef __builtin_va_list __gnuc_va_list;
-#endif
-
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
- typedef __gnuc_va_list va_list;
-#endif
-
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
@@ -52,15 +42,18 @@ extern "C" {
#ifndef _STDIO_DEFINED
_CRTIMP FILE *__cdecl __iob_func(void);
- _CRTIMP extern FILE _iob[];
+ _CRTDATA(extern FILE _iob[];)
+#ifdef _M_CEE_PURE
+#define _iob __iob_func()
+#endif
#endif
#ifndef _STDSTREAM_DEFINED
-#define stdin (&__iob_func()[0])
-#define stdout (&__iob_func()[1])
-#define stderr (&__iob_func()[2])
#define _STDSTREAM_DEFINED
-#endif
+#define stdin (&_iob[0])
+#define stdout (&_iob[1])
+#define stderr (&_iob[1])
+#endif /* !_STDSTREAM_DEFINED */
#ifndef _FSIZE_T_DEFINED
typedef unsigned long _fsize_t;
@@ -68,6 +61,15 @@ extern "C" {
#endif
#ifndef _WFINDDATA_T_DEFINED
+ struct _wfinddata_t {
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ _fsize_t size;
+ wchar_t name[260];
+ };
+
struct _wfinddata32_t {
unsigned attrib;
__time32_t time_create;
@@ -77,7 +79,15 @@ extern "C" {
wchar_t name[260];
};
-/* #if _INTEGRAL_MAX_BITS >= 64 */
+#if _INTEGRAL_MAX_BITS >= 64
+ struct _wfinddatai64_t {
+ unsigned attrib;
+ time_t time_create;
+ time_t time_access;
+ time_t time_write;
+ __int64 size;
+ wchar_t name[260];
+ };
struct _wfinddata32i64_t {
unsigned attrib;
@@ -105,28 +115,10 @@ extern "C" {
__int64 size;
wchar_t name[260];
};
-/* #endif */
-
-#ifdef _USE_32BIT_TIME_T
-#define _wfinddata_t _wfinddata32_t
-#define _wfinddatai64_t _wfinddata32i64_t
-
-#define _wfindfirst _wfindfirst32
-#define _wfindnext _wfindnext32
-#define _wfindfirsti64 _wfindfirst32i64
-#define _wfindnexti64 _wfindnext32i64
-#else
-#define _wfinddata_t _wfinddata64i32_t
-#define _wfinddatai64_t _wfinddata64_t
-
-#define _wfindfirst _wfindfirst64i32
-#define _wfindnext _wfindnext64i32
-#define _wfindfirsti64 _wfindfirst64
-#define _wfindnexti64 _wfindnext64
#endif
#define _WFINDDATA_T_DEFINED
-#endif
+#endif /* !_WFINDDATA_T_DEFINED */
#ifndef NULL
#ifdef __cplusplus
@@ -136,65 +128,37 @@ extern "C" {
#endif
#endif
-#ifndef _CONST_RETURN
-#define _CONST_RETURN
-#endif
-
-#define _WConst_return _CONST_RETURN
-
#ifndef _CRT_CTYPEDATA_DEFINED
-#define _CRT_CTYPEDATA_DEFINED
-#ifndef _CTYPE_DISABLE_MACROS
-
-#ifndef __PCTYPE_FUNC
-#define __PCTYPE_FUNC __pctype_func()
-#ifdef _MSVCRT_
-#define __pctype_func() (_pctype)
-#else
-#define __pctype_func() (*_imp___pctype)
-#endif
-#endif
-
-#ifndef _pctype
-#ifdef _MSVCRT_
- extern unsigned short *_pctype;
-#else
- extern unsigned short **_imp___pctype;
-#define _pctype (*_imp___pctype)
-#endif
-#endif
-#endif
-#endif
+# define _CRT_CTYPEDATA_DEFINED
+# ifndef _CTYPE_DISABLE_MACROS
+# ifndef __PCTYPE_FUNC
+# ifdef _DLL
+# define __PCTYPE_FUNC __pctype_func()
+# else
+# define __PCTYPE_FUNC _pctype
+# endif
+# endif /* !__PCTYPE_FUNC */
+ _CRTIMP const unsigned short * __cdecl __pctype_func(void);
+# ifndef _M_CEE_PURE
+ _CRTDATA(extern unsigned short *_pctype);
+# else
+# define _pctype (__pctype_func())
+# endif /* !_M_CEE_PURE */
+# endif /* !_CTYPE_DISABLE_MACROS */
+#endif /* !_CRT_CTYPEDATA_DEFINED */
#ifndef _CRT_WCTYPEDATA_DEFINED
#define _CRT_WCTYPEDATA_DEFINED
-#ifndef _CTYPE_DISABLE_MACROS
-#ifndef _wctype
-#ifdef _MSVCRT_
- extern unsigned short *_wctype;
-#else
- extern unsigned short **_imp___wctype;
-#define _wctype (*_imp___wctype)
-#endif
-#endif
-
-#ifdef _MSVCRT_
-#define __pwctype_func() (_pwctype)
-#else
-#define __pwctype_func() (*_imp___pwctype)
-#endif
-
-#ifndef _pwctype
-#ifdef _MSVCRT_
- extern unsigned short *_pwctype;
-#else
- extern unsigned short **_imp___pwctype;
-#define _pwctype (*_imp___pwctype)
-#endif
-#endif
-
-#endif
-#endif
+# ifndef _CTYPE_DISABLE_MACROS
+ _CRTDATA(extern unsigned short *_wctype);
+ _CRTIMP const wctype_t * __cdecl __pwctype_func(void);
+# ifndef _M_CEE_PURE
+ _CRTDATA(extern const wctype_t *_pwctype);
+# else
+# define _pwctype (__pwctype_func())
+# endif /* !_M_CEE_PURE */
+# endif /* !_CTYPE_DISABLE_MACROS */
+#endif /* !_CRT_WCTYPEDATA_DEFINED */
#define _UPPER 0x1
#define _LOWER 0x2
@@ -211,48 +175,46 @@ extern "C" {
#ifndef _WCTYPE_DEFINED
#define _WCTYPE_DEFINED
-
- int __cdecl iswalpha(wint_t _C);
+ _CRTIMP int __cdecl iswalpha(wint_t _C);
_CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswupper(wint_t _C);
+ _CRTIMP int __cdecl iswupper(wint_t _C);
_CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswlower(wint_t _C);
+ _CRTIMP int __cdecl iswlower(wint_t _C);
_CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswdigit(wint_t _C);
+ _CRTIMP int __cdecl iswdigit(wint_t _C);
_CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswxdigit(wint_t _C);
+ _CRTIMP int __cdecl iswxdigit(wint_t _C);
_CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswspace(wint_t _C);
+ _CRTIMP int __cdecl iswspace(wint_t _C);
_CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswpunct(wint_t _C);
+ _CRTIMP int __cdecl iswpunct(wint_t _C);
_CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswalnum(wint_t _C);
+ _CRTIMP int __cdecl iswalnum(wint_t _C);
_CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswprint(wint_t _C);
+ _CRTIMP int __cdecl iswprint(wint_t _C);
_CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswgraph(wint_t _C);
+ _CRTIMP int __cdecl iswgraph(wint_t _C);
_CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswcntrl(wint_t _C);
+ _CRTIMP int __cdecl iswcntrl(wint_t _C);
_CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswascii(wint_t _C);
- int __cdecl isleadbyte(int _C);
+ _CRTIMP int __cdecl iswascii(wint_t _C);
+ _CRTIMP int __cdecl isleadbyte(int _C);
_CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale);
- wint_t __cdecl towupper(wint_t _C);
+ _CRTIMP wint_t __cdecl towupper(wint_t _C);
_CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale);
- wint_t __cdecl towlower(wint_t _C);
+ _CRTIMP wint_t __cdecl towlower(wint_t _C);
_CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale);
- int __cdecl iswctype(wint_t _C,wctype_t _Type);
+ _CRTIMP int __cdecl iswctype(wint_t _C,wctype_t _Type);
_CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsymf(wint_t _C);
_CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale);
_CRTIMP int __cdecl __iswcsym(wint_t _C);
_CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale);
- int __cdecl is_wctype(wint_t _C,wctype_t _Type);
+ _CRTIMP int __cdecl is_wctype(wint_t _C,wctype_t _Type);
#endif
#ifndef _WDIRECT_DEFINED
#define _WDIRECT_DEFINED
-
_CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
_CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords);
@@ -263,7 +225,6 @@ extern "C" {
#ifndef _WIO_DEFINED
#define _WIO_DEFINED
-
_CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode);
_CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode);
_CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode);
@@ -274,10 +235,10 @@ extern "C" {
_CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData);
- intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData);
+ _CRTIMP intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData);
_CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData);
_CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData);
- int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData);
+ _CRTIMP int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData);
_CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData);
#endif
_CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag);
@@ -288,7 +249,7 @@ extern "C" {
extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0);
extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0);
#endif
-#endif
+#endif /* !_WIO_DEFINED */
#ifndef _WLOCALE_DEFINED
#define _WLOCALE_DEFINED
@@ -297,7 +258,6 @@ extern "C" {
#ifndef _WPROCESS_DEFINED
#define _WPROCESS_DEFINED
-
_CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...);
_CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...);
_CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...);
@@ -317,8 +277,8 @@ extern "C" {
#ifndef _CRT_WSYSTEM_DEFINED
#define _CRT_WSYSTEM_DEFINED
_CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
-#endif
-#endif
+#endif /* !_CRT_WSYSTEM_DEFINED */
+#endif /* !_WPROCESS_DEFINED */
#ifndef _WCTYPE_INLINE_DEFINED
#undef _CRT_WCTYPE_NOINLINE
@@ -373,19 +333,16 @@ extern "C" {
#ifndef _OFF_T_DEFINED
#define _OFF_T_DEFINED
-#ifndef _OFF_T_
-#define _OFF_T_
typedef long _off_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
+#ifndef NO_OLDNAMES
typedef long off_t;
#endif
#endif
-#endif
#ifndef _OFF64_T_DEFINED
#define _OFF64_T_DEFINED
typedef long long _off64_t;
-#if !defined(NO_OLDNAMES) || defined(_POSIX)
+#ifndef NO_OLDNAMES
typedef long long off64_t;
#endif
#endif
@@ -393,28 +350,6 @@ extern "C" {
#ifndef _STAT_DEFINED
#define _STAT_DEFINED
-#ifdef _USE_32BIT_TIME_T
-#ifdef WIN64
-#define _fstat _fstat32
-#define _stat _stat32
-#define _wstat _wstat32
-#else
-#define _fstat32 _fstat
-#define _stat32 _stat
-#define _wstat32 _wstat
-#endif
-#define _fstati64 _fstat32i64
-#define _stati64 _stat32i64
-#define _wstati64 _wstat32i64
-#else
-#define _fstat _fstat64i32
-#define _fstati64 _fstat64
-#define _stat _stat64i32
-#define _stati64 _stat64
-#define _wstat _wstat64i32
-#define _wstati64 _wstat64
-#endif
-
struct _stat32 {
_dev_t st_dev;
_ino_t st_ino;
@@ -429,6 +364,20 @@ extern "C" {
__time32_t st_ctime;
};
+ struct _stat {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ _off_t st_size;
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+ };
+
#ifndef NO_OLDNAMES
struct stat {
_dev_t st_dev;
@@ -445,7 +394,7 @@ extern "C" {
};
#endif
-/* #if _INTEGRAL_MAX_BITS >= 64 */
+#if _INTEGRAL_MAX_BITS >= 64
struct _stat32i64 {
_dev_t st_dev;
@@ -488,7 +437,7 @@ extern "C" {
__time64_t st_mtime;
__time64_t st_ctime;
};
-/* #endif */
+#endif
#define __stat64 _stat64
@@ -496,11 +445,11 @@ extern "C" {
#ifndef _WSTAT_DEFINED
#define _WSTAT_DEFINED
-
+ _CRTIMP int __cdecl _wstat(const wchar_t *_Name,struct _stat *_Stat);
_CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat);
- int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);
+ _CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat);
_CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat);
#endif
#endif
@@ -508,11 +457,6 @@ extern "C" {
#ifndef _WCONIO_DEFINED
#define _WCONIO_DEFINED
-
-#ifndef WEOF
-#define WEOF (wint_t)(0xFFFF)
-#endif
-
_CRTIMP wchar_t *_cgetws(wchar_t *_Buffer);
_CRTIMP wint_t __cdecl _getwch(void);
_CRTIMP wint_t __cdecl _getwche(void);
@@ -539,34 +483,30 @@ extern "C" {
#ifndef _WSTDIO_DEFINED
#define _WSTDIO_DEFINED
-#ifndef WEOF
-#define WEOF (wint_t)(0xFFFF)
-#endif
-
#ifdef _POSIX_
_CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode);
#else
_CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag);
#endif
- wint_t __cdecl fgetwc(FILE *_File);
+ _CRTIMP_ALT wint_t __cdecl fgetwc(FILE *_File);
_CRTIMP wint_t __cdecl _fgetwchar(void);
- wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
+ _CRTIMP wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
_CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
- wint_t __cdecl getwc(FILE *_File);
- wint_t __cdecl getwchar(void);
- wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
- wint_t __cdecl putwchar(wchar_t _Ch);
- wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
- wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File);
- int __cdecl fputws(const wchar_t *_Str,FILE *_File);
+ _CRTIMP wint_t __cdecl getwc(FILE *_File);
+ _CRTIMP wint_t __cdecl getwchar(void);
+ _CRTIMP wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
+ _CRTIMP wint_t __cdecl putwchar(wchar_t _Ch);
+ _CRTIMP_ALT wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
+ _CRTIMP wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File);
+ _CRTIMP int __cdecl fputws(const wchar_t *_Str,FILE *_File);
_CRTIMP wchar_t *__cdecl _getws(wchar_t *_String);
_CRTIMP int __cdecl _putws(const wchar_t *_Str);
- int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...);
- int __cdecl wprintf(const wchar_t *_Format,...);
+ _CRTIMP int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...);
+ _CRTIMP int __cdecl wprintf(const wchar_t *_Format,...);
_CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...);
- int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList);
- int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList);
+ _CRTIMP int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList);
+ _CRTIMP int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList);
_CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...);
_CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list);
_CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...);
@@ -574,11 +514,11 @@ extern "C" {
_CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...);
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
- int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...);
+ _CRTIMP int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...);
__CRT_INLINE int __cdecl vsnwprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) { return _vsnwprintf(s,n,format,arg); }
- int __cdecl vwscanf (const wchar_t *, va_list);
- int __cdecl vfwscanf (FILE *,const wchar_t *,va_list);
- int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list);
+ _CRTIMP int __cdecl vwscanf (const wchar_t *, va_list);
+ _CRTIMP int __cdecl vfwscanf (FILE *,const wchar_t *,va_list);
+ _CRTIMP int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list);
#endif
_CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...);
_CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...);
@@ -609,9 +549,6 @@ extern "C" {
_CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args);
_CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...);
_CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args);
-#ifndef RC_INVOKED
-#include
-#endif
#ifdef _CRT_NON_CONFORMING_SWPRINTFS
#ifndef __cplusplus
@@ -766,11 +703,6 @@ extern "C" {
_CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
#ifndef NO_OLDNAMES
- /* NOTE: There is no _wcscmpi, but this is for compatibility. */
- int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2);
- __CRT_INLINE int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) { return _wcsicmp (__ws1, __ws2); }
- #define _wcscmpi _wcsicmp
-
wchar_t *__cdecl wcsdup(const wchar_t *_Str);
#define wcswcs wcsstr
int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
@@ -864,5 +796,5 @@ __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_T
#pragma pack(pop)
-#include
+//#include
#endif
diff --git a/reactos/include/crt/wctype.h b/reactos/include/crt/wctype.h
index a44cb384af2..93ff61e9e1a 100644
--- a/reactos/include/crt/wctype.h
+++ b/reactos/include/crt/wctype.h
@@ -10,7 +10,7 @@
#error Only Win32 target is supported!
#endif
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/crt/yvals.h b/reactos/include/crt/yvals.h
index 2ac65cf54a4..9f994129243 100644
--- a/reactos/include/crt/yvals.h
+++ b/reactos/include/crt/yvals.h
@@ -6,7 +6,7 @@
#ifndef _YVALS
#define _YVALS
-#include <_mingw.h>
+#include
#pragma pack(push,_CRT_PACKING)
diff --git a/reactos/include/reactos/libs/pseh/pseh2.h b/reactos/include/reactos/libs/pseh/pseh2.h
index 378c2a0e8d8..1a45c2e10ed 100644
--- a/reactos/include/reactos/libs/pseh/pseh2.h
+++ b/reactos/include/reactos/libs/pseh/pseh2.h
@@ -49,7 +49,6 @@ typedef struct __SEH2Frame
{
_SEH2Registration_t SF_Registration;
volatile struct __SEH2TryLevel * volatile SF_TopTryLevel;
- struct _EXCEPTION_POINTERS * volatile SF_ExceptionInformation;
volatile unsigned long SF_Code;
}
_SEH2Frame_t;
@@ -143,15 +142,23 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
#define __SEH_FORCE_NEST \
__asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
-#define __SEH_DECLARE_EXCEPT_PFN(NAME_) int (__cdecl * NAME_)(void)
-#define __SEH_DECLARE_EXCEPT(NAME_) int __cdecl NAME_(void)
-#define __SEH_DEFINE_EXCEPT(NAME_) int __cdecl NAME_(void)
+#define __SEH_EXCEPT_RET long
+#define __SEH_EXCEPT_ARGS __attribute__((unused)) _SEH2Frame_t * _SEH2FrameP, __attribute__((unused)) struct _EXCEPTION_POINTERS * _SEHExceptionInformation
+#define __SEH_EXCEPT_ARGS_ , __SEH_EXCEPT_ARGS
+#define __SEH_EXCEPT_PFN __SEH_DECLARE_EXCEPT_PFN
+#define __SEH_DECLARE_EXCEPT_PFN(NAME_) __SEH_EXCEPT_RET (__cdecl * NAME_)(__SEH_EXCEPT_ARGS)
+#define __SEH_DECLARE_EXCEPT(NAME_) __SEH_EXCEPT_RET __cdecl NAME_(__SEH_EXCEPT_ARGS)
+#define __SEH_DEFINE_EXCEPT(NAME_) __SEH_EXCEPT_RET __cdecl NAME_(__SEH_EXCEPT_ARGS)
-#define __SEH_DECLARE_FINALLY_PFN(NAME_) void (__cdecl * NAME_)(void)
-#define __SEH_DECLARE_FINALLY(NAME_) void __cdecl NAME_(void)
-#define __SEH_DEFINE_FINALLY(NAME_) void __cdecl NAME_(void)
+#define __SEH_FINALLY_RET void
+#define __SEH_FINALLY_ARGS void
+#define __SEH_FINALLY_ARGS_
+#define __SEH_FINALLY_PFN __SEH_DECLARE_FINALLY_PFN
+#define __SEH_DECLARE_FINALLY_PFN(NAME_) __SEH_FINALLY_RET (__cdecl * NAME_)(__SEH_FINALLY_ARGS)
+#define __SEH_DECLARE_FINALLY(NAME_) __SEH_FINALLY_RET __cdecl NAME_(__SEH_FINALLY_ARGS)
+#define __SEH_DEFINE_FINALLY(NAME_) __SEH_FINALLY_RET __cdecl NAME_(__SEH_FINALLY_ARGS)
-#define __SEH_RETURN_EXCEPT(R_) return (int)(R_)
+#define __SEH_RETURN_EXCEPT(R_) return (long)(R_)
#define __SEH_RETURN_FINALLY() return
#define __SEH_BEGIN_TRY \
@@ -178,9 +185,9 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
#define __SEH_LEAVE_TRYLEVEL() __SEH_SET_TRYLEVEL(_SEHPrevTryLevelP)
#define __SEH_END_SCOPE_CHAIN \
- static const int _SEH2ScopeKind = 1; \
- static _SEH2Frame_t * const _SEH2FrameP = 0; \
- static _SEH2TryLevel_t * const _SEH2TryLevelP = 0;
+ static __attribute__((unused)) const int _SEH2ScopeKind = 1; \
+ static __attribute__((unused)) _SEH2Frame_t * const _SEH2FrameP = 0; \
+ static __attribute__((unused)) _SEH2TryLevel_t * const _SEH2TryLevelP = 0;
#define __SEH_BEGIN_SCOPE \
for(;;) \
@@ -290,35 +297,39 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
\
_SEHBeforeTry:; \
\
- if(__builtin_constant_p((__VA_ARGS__))) \
{ \
- if((__VA_ARGS__) > 0) \
+ __attribute__((unused)) struct _EXCEPTION_POINTERS * volatile _SEHExceptionInformation; \
+ \
+ if(__builtin_constant_p((__VA_ARGS__))) \
{ \
- _SEHTryLevel.ST_Filter = (void *)1; \
- _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
- __SEH_USE_LABEL(_SEHBeginExcept); \
- } \
- else if((__VA_ARGS__) < 0) \
- { \
- _SEHTryLevel.ST_Filter = (void *)-1; \
- _SEHTryLevel.ST_Body = NULL; \
+ if((__VA_ARGS__) > 0) \
+ { \
+ _SEHTryLevel.ST_Filter = (void *)1; \
+ _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
+ __SEH_USE_LABEL(_SEHBeginExcept); \
+ } \
+ else if((__VA_ARGS__) < 0) \
+ { \
+ _SEHTryLevel.ST_Filter = (void *)-1; \
+ _SEHTryLevel.ST_Body = NULL; \
+ } \
+ else \
+ { \
+ _SEHTryLevel.ST_Filter = (void *)0; \
+ _SEHTryLevel.ST_Body = NULL; \
+ } \
} \
else \
{ \
- _SEHTryLevel.ST_Filter = (void *)0; \
- _SEHTryLevel.ST_Body = NULL; \
- } \
- } \
- else \
- { \
- __SEH_DEFINE_EXCEPT(_SEHExcept) \
- { \
- __SEH_RETURN_EXCEPT((__VA_ARGS__)); \
- } \
+ __SEH_DEFINE_EXCEPT(_SEHExcept) \
+ { \
+ __SEH_RETURN_EXCEPT((__VA_ARGS__)); \
+ } \
\
- _SEHTryLevel.ST_Filter = &_SEHExcept; \
- _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
- __SEH_USE_LABEL(_SEHBeginExcept); \
+ _SEHTryLevel.ST_Filter = &_SEHExcept; \
+ _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
+ __SEH_USE_LABEL(_SEHBeginExcept); \
+ } \
} \
\
__SEH_BARRIER; \
@@ -350,8 +361,6 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
_SEHBeginExcept:; \
{ \
{ \
- _SEH2Frame_t * const _SEH2FrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
- (void)_SEH2FrameP; \
__SEH_BARRIER;
#define _SEH2_END \
@@ -363,7 +372,7 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
} \
__SEH_END_SCOPE;
-#define _SEH2_GetExceptionInformation() ((_SEH2FrameP)->SF_ExceptionInformation)
+#define _SEH2_GetExceptionInformation() (_SEHExceptionInformation)
#define _SEH2_GetExceptionCode() ((_SEH2FrameP)->SF_Code)
#define _SEH2_AbnormalTermination() (_SEHAbnormalTermination)
diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h
index 487b9e6af98..56e3b527dfb 100644
--- a/reactos/include/reactos/win32k/ntuser.h
+++ b/reactos/include/reactos/win32k/ntuser.h
@@ -277,6 +277,27 @@ typedef struct _SERVERINFO
COLORREF SysColors[COLOR_MENUBAR+1]; // GetSysColor
HBRUSH SysColorBrushes[COLOR_MENUBAR+1]; // GetSysColorBrush
HPEN SysColorPens[COLOR_MENUBAR+1]; // ReactOS exclusive
+ HBRUSH hbrGray;
+ POINTL ptCursor;
+ //
+ DWORD cxSysFontChar;
+ DWORD cySysFontChar;
+ DWORD cxMsgFontChar;
+ DWORD cyMsgFontChar;
+ TEXTMETRICW tmSysFont;
+ //
+ RECTL rcScreen;
+ WORD BitCount;
+ WORD dmLogPixels;
+ BYTE BitsPixel;
+ BYTE Planes;
+ WORD reserved;
+ DWORD PUSIFlags; // PERUSERSERVERINFO Flags.
+ ULONG uCaretWidth;
+ LANGID UILangID;
+ UINT LastRITWasKeyboard : 1;
+ UINT bKeyboardPref : 1;
+ DWORD TimeTick;
DWORD SrvEventActivity;
} SERVERINFO, *PSERVERINFO;
diff --git a/reactos/include/reactos/wine/config.h b/reactos/include/reactos/wine/config.h
index e4f02e7c2dd..d48b672f724 100644
--- a/reactos/include/reactos/wine/config.h
+++ b/reactos/include/reactos/wine/config.h
@@ -442,7 +442,7 @@
/* Define to 1 if the system has the type `pid_t'. */
#if !defined(_MSC_VER)
-#define HAVE_PID_T 1
+//#define HAVE_PID_T 1
#endif
/* Define to 1 if you have the header file. */
diff --git a/reactos/include/reactos/wine/exception.h b/reactos/include/reactos/wine/exception.h
index af390505e71..ec156adf928 100644
--- a/reactos/include/reactos/wine/exception.h
+++ b/reactos/include/reactos/wine/exception.h
@@ -9,6 +9,9 @@
extern "C" {
#endif
+typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
+ (struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
+
struct _EXCEPTION_REGISTRATION_RECORD;
typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
@@ -37,6 +40,13 @@ struct _EXCEPTION_REGISTRATION_RECORD
#define AbnormalTermination() _SEH2_AbnormalTermination()
#endif
+/* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD */
+#define EH_NONCONTINUABLE 0x01
+#define EH_UNWINDING 0x02
+#define EH_EXIT_UNWIND 0x04
+#define EH_STACK_INVALID 0x08
+#define EH_NESTED_CALL 0x10
+
#define EXCEPTION_WINE_STUB 0x80000100
#define EXCEPTION_WINE_ASSERTION 0x80000101
diff --git a/reactos/lib/pseh/framebased-gcchack.c b/reactos/lib/pseh/framebased-gcchack.c
index efb9cbb27f7..d69f7884f91 100644
--- a/reactos/lib/pseh/framebased-gcchack.c
+++ b/reactos/lib/pseh/framebased-gcchack.c
@@ -20,14 +20,15 @@
DEALINGS IN THE SOFTWARE.
*/
-#define _NTSYSTEM_
+#define _NTSYSTEM_ /* removes dllimport attribute from RtlUnwind */
+
#define STRICT
#define WIN32_LEAN_AND_MEAN
#include
#include
-
#include
+#include
#ifndef EXCEPTION_EXIT_UNWIND
#define EXCEPTION_EXIT_UNWIND 4
@@ -37,18 +38,29 @@
#define EXCEPTION_UNWINDING 2
#endif
-extern _SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void);
-
-extern int __SEH2Except(void *, void *);
-extern void __SEH2Finally(void *, void *);
extern DECLSPEC_NORETURN int __SEH2Handle(void *, void *, void *);
-
-extern void __cdecl __SEH2EnterFrame(_SEH2Registration_t *);
-extern void __cdecl __SEH2LeaveFrame(void);
-
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
extern int __cdecl __SEH2NestedHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
+FORCEINLINE
+_SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void)
+{
+ return (_SEH2Registration_t *)__readfsdword(0);
+}
+
+FORCEINLINE
+void __cdecl __SEH2EnterFrame(_SEH2Registration_t * frame)
+{
+ frame->SER_Prev = _SEH2CurrentRegistration();
+ __writefsdword(0, (unsigned long)frame);
+}
+
+FORCEINLINE
+void __cdecl __SEH2LeaveFrame(void)
+{
+ __writefsdword(0, (unsigned long)_SEH2CurrentRegistration()->SER_Prev);
+}
+
FORCEINLINE
void _SEH2GlobalUnwind(void * target)
{
@@ -67,11 +79,12 @@ void _SEH2GlobalUnwind(void * target)
);
}
-FORCEINLINE
-int _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
+static
+__SEH_EXCEPT_RET _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel, struct _EXCEPTION_POINTERS * ep)
{
void * filter = trylevel->ST_Filter;
void * context = NULL;
+ __SEH_EXCEPT_RET ret;
if(filter == (void *)0)
return 0;
@@ -88,10 +101,22 @@ int _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
filter = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)filter);
}
- return __SEH2Except(filter, context);
+ __asm__ __volatile__
+ (
+ "push %[ep]\n"
+ "push %[frame]\n"
+ "call *%[filter]\n"
+ "pop %%edx\n"
+ "pop %%edx\n" :
+ [ret] "=a" (ret) :
+ "c" (context), [filter] "r" (filter), [frame] "g" (frame), [ep] "g" (ep) :
+ "edx", "flags", "memory"
+ );
+
+ return ret;
}
-FORCEINLINE
+static
void _SEH2Finally(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
{
if(trylevel->ST_Filter == NULL && trylevel->ST_Body != NULL)
@@ -105,7 +130,7 @@ void _SEH2Finally(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)body);
}
- __SEH2Finally(body, context);
+ __asm__ __volatile__("call *%1\n" : : "c" (context), "r" (body) : "eax", "edx", "flags", "memory");
}
}
@@ -179,11 +204,10 @@ int __cdecl _SEH2FrameHandler
ep.ContextRecord = ContextRecord;
frame->SF_Code = ExceptionRecord->ExceptionCode;
- frame->SF_ExceptionInformation = &ep;
for(trylevel = frame->SF_TopTryLevel; trylevel != NULL; trylevel = trylevel->ST_Next)
{
- ret = _SEH2Except(frame, trylevel);
+ ret = _SEH2Except(frame, trylevel, &ep);
if(ret < 0)
return ExceptionContinueExecution;
diff --git a/reactos/lib/pseh/i386/framebased-gcchack.S b/reactos/lib/pseh/i386/framebased-gcchack.S
index 191921fd8f4..d60f6cf7ccb 100644
--- a/reactos/lib/pseh/i386/framebased-gcchack.S
+++ b/reactos/lib/pseh/i386/framebased-gcchack.S
@@ -21,32 +21,6 @@
.text
.intel_syntax noprefix
-.func _SEH2CurrentRegistration
-.globl __SEH2CurrentRegistration
-__SEH2CurrentRegistration:
- mov eax, [fs:0]
- ret
-.endfunc
-
-.func __SEH2EnterFrame
-.globl ___SEH2EnterFrame
-___SEH2EnterFrame:
- mov eax, [esp+4]
- mov ecx, [fs:0]
- mov [eax], ecx
- mov [fs:0], eax
- ret
-.endfunc
-
-.func __SEH2LeaveFrame
-.globl ___SEH2LeaveFrame
-___SEH2LeaveFrame:
- mov eax, [fs:0]
- mov eax, [eax]
- mov [fs:0], eax
- ret
-.endfunc
-
.func __SEH2Handle
.globl ___SEH2Handle
___SEH2Handle:
@@ -56,28 +30,6 @@ ___SEH2Handle:
jmp eax
.endfunc
-.func __SEH2Except
-.globl ___SEH2Except
-___SEH2Except:
- mov eax, [esp+4]
- mov ecx, [esp+8]
-
- call eax
-
- ret
-.endfunc
-
-.func __SEH2Finally
-.globl ___SEH2Finally
-___SEH2Finally:
- mov eax, [esp+4]
- mov ecx, [esp+8]
-
- call eax
-
- ret
-.endfunc
-
.func __SEH2FrameHandler
.globl ___SEH2FrameHandler
___SEH2FrameHandler:
diff --git a/reactos/lib/sdk/crt/except/cpp.c b/reactos/lib/sdk/crt/except/cpp.c
index 1977afe135b..692c5e78e65 100644
--- a/reactos/lib/sdk/crt/except/cpp.c
+++ b/reactos/lib/sdk/crt/except/cpp.c
@@ -19,28 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
-#include
-
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "wine/exception.h"
-#include "winnt.h"
-#include "excpt.h"
-#include "wine/debug.h"
-#include
-#include
-#include
+#include
#include
#include
-#include
-
-WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
typedef exception bad_cast;
typedef exception bad_typeid;
@@ -76,7 +58,6 @@ typedef struct _rtti_object_locator
const rtti_object_hierarchy *type_hierarchy;
} rtti_object_locator;
-
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func
diff --git a/reactos/lib/sdk/crt/except/cppexcept.c b/reactos/lib/sdk/crt/except/cppexcept.c
index ae6d9c3b553..5e301dae8b5 100644
--- a/reactos/lib/sdk/crt/except/cppexcept.c
+++ b/reactos/lib/sdk/crt/except/cppexcept.c
@@ -23,20 +23,11 @@
* www.thecodeproject.com.
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
+#define __WINE_DEBUG_CHANNEL__
+#include
#include
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
#include
-#include "wine/exception.h"
-#include "excpt.h"
-#include "wine/debug.h"
-
#include
#ifdef __i386__ /* CxxFrameHandler is not supported on non-i386 */
@@ -328,7 +319,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
/* setup an exception block for nested exceptions */
- nested_frame.frame.Handler = (PEXCEPTION_HANDLER)catch_function_nested_handler;
+ nested_frame.frame.Handler = (PEXCEPTION_ROUTINE)catch_function_nested_handler;
nested_frame.prev_rec = thread_data->exc_record;
nested_frame.cxx_frame = frame;
nested_frame.descr = descr;
diff --git a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
index 2b34f55ce25..2cead03a04d 100644
--- a/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
+++ b/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
@@ -21,6 +21,57 @@
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
+#include
+
+/* Macros to define assembler functions somewhat portably */
+
+#define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
+#define __ASM_NAME(name) "_" name
+
+#ifdef __GNUC__
+# define __ASM_GLOBAL_FUNC(name,code) \
+ __asm__( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ __ASM_FUNC(#name) "\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code );
+#else /* __GNUC__ */
+# define __ASM_GLOBAL_FUNC(name,code) \
+ void __asm_dummy_##name(void) { \
+ asm( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ __ASM_FUNC(#name) "\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code ); \
+ }
+#endif /* __GNUC__ */
+
+#define EH_NONCONTINUABLE 0x01
+#define EH_UNWINDING 0x02
+#define EH_EXIT_UNWIND 0x04
+#define EH_STACK_INVALID 0x08
+#define EH_NESTED_CALL 0x10
+
+static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
+{
+ frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
+ __writefsdword(0, (unsigned long)frame);
+ return frame->Next;
+}
+
+static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
+{
+ __writefsdword(0, (unsigned long)frame->Next);
+ return frame->Next;
+}
+
+#define __TRY _SEH2_TRY
+#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
+#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
+#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
+#define __ENDTRY _SEH2_END
+#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
+
#define CXX_FRAME_MAGIC 0x19930520
#define CXX_EXCEPTION 0xe06d7363
diff --git a/reactos/lib/sdk/crt/locale/locale.c b/reactos/lib/sdk/crt/locale/locale.c
index e4ffa649da1..28326880b94 100644
--- a/reactos/lib/sdk/crt/locale/locale.c
+++ b/reactos/lib/sdk/crt/locale/locale.c
@@ -150,7 +150,7 @@ static void remap_synonym(char *name)
size_t i;
for (i = 0; i < sizeof(_country_synonyms)/sizeof(char*); i += 2 )
{
- if (!strcasecmp(_country_synonyms[i],name))
+ if (!_stricmp(_country_synonyms[i],name))
{
TRACE(":Mapping synonym %s to %s\n",name,_country_synonyms[i+1]);
name[0] = _country_synonyms[i+1][0];
@@ -172,7 +172,7 @@ static int compare_info(LCID lcid, DWORD flags, char* buff, const char* cmp)
if (!buff[0] || !cmp[0])
return 0;
/* Partial matches are allowed, e.g. "Germ" matches "Germany" */
- return !strncasecmp(cmp, buff, strlen(cmp));
+ return !_strnicmp(cmp, buff, strlen(cmp));
}
@@ -271,12 +271,12 @@ static LCID MSVCRT_locale_to_LCID(locale_search_t* locale)
else
{
/* Special codepage values: OEM & ANSI */
- if (strcasecmp(locale->search_codepage,"OCP"))
+ if (_stricmp(locale->search_codepage,"OCP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTCODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
}
- if (strcasecmp(locale->search_codepage,"ACP"))
+ if (_stricmp(locale->search_codepage,"ACP"))
{
GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE,
locale->found_codepage, MAX_ELEM_LEN);
diff --git a/reactos/lib/sdk/crt/mbstring/ismblead.c b/reactos/lib/sdk/crt/mbstring/ismblead.c
index 9b315ae93db..30511b840b2 100644
--- a/reactos/lib/sdk/crt/mbstring/ismblead.c
+++ b/reactos/lib/sdk/crt/mbstring/ismblead.c
@@ -45,7 +45,7 @@ int _ismbslead( const unsigned char *start, const unsigned char *str)
/*
* @implemented
*/
-const unsigned char *__p__mbctype(void)
+unsigned char *__p__mbctype(void)
{
return _mbctype;
}
diff --git a/reactos/lib/sdk/crt/precomp.h b/reactos/lib/sdk/crt/precomp.h
index d4979dd7a0f..0d8afa002cf 100644
--- a/reactos/lib/sdk/crt/precomp.h
+++ b/reactos/lib/sdk/crt/precomp.h
@@ -39,7 +39,9 @@
/* kernelmode libcnt should not include Wine-debugging crap */
#ifndef _LIBCNT_
#include "wine/debug.h"
+#ifndef __WINE_DEBUG_CHANNEL__
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
+#endif
#else
#include
#define TRACE DPRINT
diff --git a/reactos/lib/sdk/crt/wine/undname.c b/reactos/lib/sdk/crt/wine/undname.c
index 07e6a062232..178ff88bab9 100755
--- a/reactos/lib/sdk/crt/wine/undname.c
+++ b/reactos/lib/sdk/crt/wine/undname.c
@@ -19,27 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
+#define __WINE_DEBUG_CHANNEL__
+#include
#include
-#include
-#include
-
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "wine/exception.h"
-#include "winnt.h"
-#include "excpt.h"
-#include "wine/debug.h"
-#include
-#include
#include
#include
-#include
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
diff --git a/reactos/ntoskrnl/config/cmparse.c b/reactos/ntoskrnl/config/cmparse.c
index 7e6d9d264c8..79c35d48213 100644
--- a/reactos/ntoskrnl/config/cmparse.c
+++ b/reactos/ntoskrnl/config/cmparse.c
@@ -492,16 +492,7 @@ CmpDoCreate(IN PHHIVE Hive,
ASSERT(KeyBody->KeyControlBlock->ParentKcb->KeyCell == Cell);
ASSERT(KeyBody->KeyControlBlock->ParentKcb->KeyHive == Hive);
ASSERT(KeyBody->KeyControlBlock->ParentKcb == ParentKcb);
- //ASSERT(KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen == KeyNode->MaxNameLen);
- if (KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen != KeyNode->MaxNameLen)
- {
- /* HACK: this gets unsynced due to (?) mismatching KCB referencing */
- DPRINT1("BUG: KCB MaxNameLen %d does not match KeyNode's MaxNameLen %d!\n",
- KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen, KeyNode->MaxNameLen);
-
- /* Manually sync MaxNameLens, remove once fixed */
- KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = KeyNode->MaxNameLen;
- }
+ ASSERT(KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen == KeyNode->MaxNameLen);
/* Update the timestamp */
KeQuerySystemTime(&TimeStamp);
@@ -599,38 +590,74 @@ CmpDoOpen(IN PHHIVE Hive,
/* If we have a KCB, make sure it's locked */
//ASSERT(CmpIsKcbLockedExclusive(*CachedKcb));
- /* Check if this is a symlink */
- if ((Node->Flags & KEY_SYM_LINK) && !(Attributes & OBJ_OPENLINK))
+ /* Check if caller doesn't want to create a KCB */
+ if (ControlFlags & CMP_OPEN_KCB_NO_CREATE)
{
- /* Create the KCB for the symlink */
+ /* Check if this is a symlink */
+ if ((Node->Flags & KEY_SYM_LINK) && !(Attributes & OBJ_OPENLINK))
+ {
+ /* This case for a cached KCB is not implemented yet */
+ ASSERT(FALSE);
+ }
+
+ /* The caller wants to open a cached KCB */
+ if (!CmpReferenceKeyControlBlock(*CachedKcb))
+ {
+ /* Release the registry lock */
+ CmpUnlockRegistry();
+
+ /* Return failure code */
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* Our kcb is that one */
+ Kcb = *CachedKcb;
+ }
+ else
+ {
+ /* Check if this is a symlink */
+ if ((Node->Flags & KEY_SYM_LINK) && !(Attributes & OBJ_OPENLINK))
+ {
+ /* Create the KCB for the symlink */
+ Kcb = CmpCreateKeyControlBlock(Hive,
+ Cell,
+ Node,
+ *CachedKcb,
+ 0,
+ KeyName);
+ if (!Kcb)
+ {
+ /* Release registry lock and return failure */
+ CmpUnlockRegistry();
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* Make sure it's also locked, and set the pointer */
+ //ASSERT(CmpIsKcbLockedExclusive(Kcb));
+ *CachedKcb = Kcb;
+
+ /* Release the registry lock */
+ CmpUnlockRegistry();
+
+ /* Return reparse required */
+ return STATUS_REPARSE;
+ }
+
+ /* Create the KCB. FIXME: Use lock flag */
Kcb = CmpCreateKeyControlBlock(Hive,
Cell,
Node,
*CachedKcb,
0,
KeyName);
- if (!Kcb) return STATUS_INSUFFICIENT_RESOURCES;
-
- /* Make sure it's also locked, and set the pointer */
- //ASSERT(CmpIsKcbLockedExclusive(Kcb));
- *CachedKcb = Kcb;
-
- /* Release the registry lock */
- CmpUnlockRegistry();
-
- /* Return reparse required */
- return STATUS_REPARSE;
+ if (!Kcb)
+ {
+ /* Release registry lock and return failure */
+ CmpUnlockRegistry();
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
}
- /* Create the KCB. FIXME: Use lock flag */
- Kcb = CmpCreateKeyControlBlock(Hive,
- Cell,
- Node,
- *CachedKcb,
- 0,
- KeyName);
- if (!Kcb) return STATUS_INSUFFICIENT_RESOURCES;
-
/* Make sure it's also locked, and set the pointer */
//ASSERT(CmpIsKcbLockedExclusive(Kcb));
*CachedKcb = Kcb;
@@ -977,7 +1004,13 @@ CmpBuildHashStackAndLookupCache(IN PCM_KEY_BODY ParseObject,
/* Return hive and cell data */
*Hive = (*Kcb)->KeyHive;
*Cell = (*Kcb)->KeyCell;
-
+
+ /* Make sure it's not a dead KCB */
+ ASSERT((*Kcb)->RefCount > 0);
+
+ /* Reference it */
+ (VOID)CmpReferenceKeyControlBlock(*Kcb);
+
/* Return success for now */
return STATUS_SUCCESS;
}
@@ -1197,7 +1230,7 @@ CmpParseKey(IN PVOID ParseObject,
if (!Kcb) ASSERT(FALSE);
/* Dereference the parent and set the new one */
- //CmpDereferenceKeyControlBlock(ParentKcb);
+ CmpDereferenceKeyControlBlock(ParentKcb);
ParentKcb = Kcb;
}
else
@@ -1302,10 +1335,7 @@ CmpParseKey(IN PVOID ParseObject,
&CellToRelease);
if (!Node) ASSERT(FALSE);
}
-
- /* FIXME: This hack seems required? */
- RtlInitUnicodeString(&NextName, L"\\REGISTRY");
-
+
/* Do the open */
Status = CmpDoOpen(Hive,
Cell,
@@ -1314,7 +1344,7 @@ CmpParseKey(IN PVOID ParseObject,
AccessMode,
Attributes,
ParseContext,
- 0,
+ CMP_OPEN_KCB_NO_CREATE /* | CMP_CREATE_KCB_KCB_LOCKED */,
&Kcb,
&NextName,
Object);
@@ -1336,7 +1366,7 @@ CmpParseKey(IN PVOID ParseObject,
/* Dereference the parent if it exists */
Quickie:
- //if (ParentKcb) CmpDereferenceKeyControlBlock(ParentKcb);
+ if (ParentKcb) CmpDereferenceKeyControlBlock(ParentKcb);
/* Unlock the registry */
CmpUnlockRegistry();
diff --git a/reactos/ntoskrnl/include/internal/cm.h b/reactos/ntoskrnl/include/internal/cm.h
index 4cc872dbdc9..91a07172d51 100644
--- a/reactos/ntoskrnl/include/internal/cm.h
+++ b/reactos/ntoskrnl/include/internal/cm.h
@@ -85,12 +85,24 @@
#define CMP_CREATE_FAKE_KCB 0x1
#define CMP_LOCK_HASHES_FOR_KCB 0x2
+//
+// CmpDoCreate and CmpDoOpen flags
+//
+#define CMP_CREATE_KCB_KCB_LOCKED 0x2
+#define CMP_OPEN_KCB_NO_CREATE 0x4
+
//
// EnlistKeyBodyWithKCB Flags
//
#define CMP_ENLIST_KCB_LOCKED_SHARED 0x1
#define CMP_ENLIST_KCB_LOCKED_EXCLUSIVE 0x2
+//
+// Unload Flags
+//
+#define CMP_UNLOCK_KCB_LOCKED 0x1
+#define CMP_UNLOCK_REGISTRY_LOCKED 0x2
+
//
// Maximum size of Value Cache
//
@@ -1420,6 +1432,13 @@ CmLoadKey(
IN PCM_KEY_BODY KeyBody
);
+NTSTATUS
+NTAPI
+CmUnloadKey(
+ IN PCM_KEY_CONTROL_BLOCK Kcb,
+ IN ULONG Flags
+);
+
//
// Startup and Shutdown
//
diff --git a/reactos/ntoskrnl/include/internal/i386/asmmacro.S b/reactos/ntoskrnl/include/internal/i386/asmmacro.S
index 370be0a4c66..d97adbec6f2 100644
--- a/reactos/ntoskrnl/include/internal/i386/asmmacro.S
+++ b/reactos/ntoskrnl/include/internal/i386/asmmacro.S
@@ -96,10 +96,8 @@
.macro UNHANDLED_PATH
/* Get EIP */
call $+5
- pop eax
/* Print debug message */
- push eax
push offset _UnhandledMsg
call _DbgPrint
add esp, 8
diff --git a/reactos/subsystems/win32/win32k/include/text.h b/reactos/subsystems/win32/win32k/include/text.h
index e940eb2fab4..8e1638d1628 100644
--- a/reactos/subsystems/win32/win32k/include/text.h
+++ b/reactos/subsystems/win32/win32k/include/text.h
@@ -104,6 +104,8 @@ DWORD FASTCALL ftGdiGetFontData(PFONTGDI,DWORD,DWORD,PVOID,DWORD);
BOOL FASTCALL IntGdiGetFontResourceInfo(PUNICODE_STRING,PVOID,DWORD*,DWORD);
BOOL FASTCALL ftGdiRealizationInfo(PFONTGDI,PREALIZATION_INFO);
DWORD FASTCALL ftGdiGetKerningPairs(PFONTGDI,DWORD,LPKERNINGPAIR);
+BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL LPRECT,
+ IN LPWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD);
#define IntLockProcessPrivateFonts(W32Process) \
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c
index c7a932cee1b..5c09b2945ff 100644
--- a/reactos/subsystems/win32/win32k/ntuser/desktop.c
+++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c
@@ -1536,7 +1536,7 @@ NtUserPaintDesktop(HDC hDC)
align_old = IntGdiSetTextAlign(hDC, TA_RIGHT);
mode_old = IntGdiSetBkMode(hDC, TRANSPARENT);
- NtGdiExtTextOutW(hDC, rect.right-16, rect.bottom-48, 0, NULL, s_wszVersion, len, NULL, 0);
+ GreExtTextOutW(hDC, rect.right-16, rect.bottom-48, 0, NULL, s_wszVersion, len, NULL, 0);
IntGdiSetBkMode(hDC, mode_old);
IntGdiSetTextAlign(hDC, align_old);
diff --git a/reactos/subsystems/win32/win32k/ntuser/painting.c b/reactos/subsystems/win32/win32k/ntuser/painting.c
index 10e26225b23..995dddf6b0d 100644
--- a/reactos/subsystems/win32/win32k/ntuser/painting.c
+++ b/reactos/subsystems/win32/win32k/ntuser/painting.c
@@ -1594,7 +1594,7 @@ UserDrawCaptionText(HDC hDc,
//FIXME: If string doesn't fit to rc, truncate it and add ellipsis.
- NtGdiExtTextOutW(hDc, lpRc->left,
+ GreExtTextOutW(hDc, lpRc->left,
lpRc->top, 0, NULL, Text->Buffer,
Text->Length/sizeof(WCHAR), NULL, 0);
diff --git a/reactos/subsystems/win32/win32k/ntuser/winsta.c b/reactos/subsystems/win32/win32k/ntuser/winsta.c
index 4bb1b28d888..8925dd2474d 100644
--- a/reactos/subsystems/win32/win32k/ntuser/winsta.c
+++ b/reactos/subsystems/win32/win32k/ntuser/winsta.c
@@ -315,6 +315,11 @@ co_IntInitializeDesktopGraphics(VOID)
NtGdiSelectFont( hSystemBM, NtGdiGetStockObject(SYSTEM_FONT));
IntGdiSetDCOwnerEx( hSystemBM, GDI_OBJ_HMGR_PUBLIC, FALSE);
+ // FIXME! Move these to a update routine.
+ gpsi->Planes = NtGdiGetDeviceCaps(ScreenDeviceContext, PLANES);
+ gpsi->BitsPixel = NtGdiGetDeviceCaps(ScreenDeviceContext, BITSPIXEL);
+ gpsi->BitCount = gpsi->Planes * gpsi->BitsPixel;
+
return TRUE;
}
diff --git a/reactos/subsystems/win32/win32k/objects/font.c b/reactos/subsystems/win32/win32k/objects/font.c
index f1c7a1c4cd2..1f49571ee5d 100644
--- a/reactos/subsystems/win32/win32k/objects/font.c
+++ b/reactos/subsystems/win32/win32k/objects/font.c
@@ -728,6 +728,10 @@ NtGdiHfontCreate(
PTEXTOBJ TextObj;
NTSTATUS Status = STATUS_SUCCESS;
+ /* Silence GCC warnings */
+ SafeLogfont.elfEnumLogfontEx.elfLogFont.lfEscapement = 0;
+ SafeLogfont.elfEnumLogfontEx.elfLogFont.lfOrientation = 0;
+
if (!pelfw)
{
return NULL;
diff --git a/reactos/subsystems/win32/win32k/objects/freetype.c b/reactos/subsystems/win32/win32k/objects/freetype.c
index af696751373..97636614a5c 100644
--- a/reactos/subsystems/win32/win32k/objects/freetype.c
+++ b/reactos/subsystems/win32/win32k/objects/freetype.c
@@ -3079,15 +3079,15 @@ NtGdiGetFontFamilyInfo(HDC Dc,
BOOL
APIENTRY
-NtGdiExtTextOutW(
+GreExtTextOutW(
IN HDC hDC,
IN INT XStart,
IN INT YStart,
IN UINT fuOptions,
IN OPTIONAL LPRECT lprc,
- IN LPWSTR UnsafeString,
+ IN LPWSTR String,
IN INT Count,
- IN OPTIONAL LPINT UnsafeDx,
+ IN OPTIONAL LPINT Dx,
IN DWORD dwCodePage)
{
/*
@@ -3108,7 +3108,7 @@ NtGdiExtTextOutW(
LONGLONG TextLeft, RealXStart;
ULONG TextTop, previous, BackgroundLeft;
FT_Bool use_kerning;
- RECTL DestRect, MaskRect, SpecifiedDestRect;
+ RECTL DestRect, MaskRect;
POINTL SourcePoint, BrushOrigin;
HBRUSH hBrushFg = NULL;
PGDIBRUSHOBJ BrushFg = NULL;
@@ -3129,12 +3129,10 @@ NtGdiExtTextOutW(
ULONG Mode;
FT_Render_Mode RenderMode;
BOOLEAN Render;
- NTSTATUS Status;
- INT *Dx = NULL;
POINT Start;
BOOL DoBreak = FALSE;
- LPCWSTR String, SafeString = NULL;
HPALETTE hDestPalette;
+ USHORT DxShift;
// TODO: Write test-cases to exactly match real Windows in different
// bad parameters (e.g. does Windows check the DC or the RECT first?).
@@ -3155,49 +3153,13 @@ NtGdiExtTextOutW(
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
/* Check if String is valid */
- if ((Count > 0xFFFF) || (Count > 0 && UnsafeString == NULL))
+ if ((Count > 0xFFFF) || (Count > 0 && String == NULL))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
goto fail;
}
- if (Count > 0)
- {
- SafeString = ExAllocatePoolWithTag(PagedPool, Count * sizeof(WCHAR), TAG_GDITEXT);
- if (!SafeString)
- {
- goto fail;
- }
- Status = MmCopyFromCaller(SafeString, UnsafeString, Count * sizeof(WCHAR));
- if (! NT_SUCCESS(Status))
- {
- goto fail;
- }
- }
- String = SafeString;
- if (NULL != UnsafeDx && Count > 0)
- {
- Dx = ExAllocatePoolWithTag(PagedPool, Count * sizeof(INT), TAG_GDITEXT);
- if (NULL == Dx)
- {
- goto fail;
- }
- Status = MmCopyFromCaller(Dx, UnsafeDx, Count * sizeof(INT));
- if (!NT_SUCCESS(Status))
- {
- goto fail;
- }
- }
-
- if (lprc)
- {
- Status = MmCopyFromCaller(&SpecifiedDestRect, lprc, sizeof(RECT));
- if (!NT_SUCCESS(Status))
- {
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- goto fail;
- }
- }
+ DxShift = fuOptions & ETO_PDY ? 1 : 0;
if (PATH_IsPathOpen(dc->DcLevel))
{
@@ -3205,8 +3167,8 @@ NtGdiExtTextOutW(
XStart,
YStart,
fuOptions,
- (const RECT *)&SpecifiedDestRect,
- SafeString,
+ (const RECT *)lprc,
+ String,
Count,
(const INT *)Dx)) goto fail;
goto good;
@@ -3214,7 +3176,7 @@ NtGdiExtTextOutW(
if (lprc && (fuOptions & (ETO_OPAQUE | ETO_CLIPPED)))
{
- IntLPtoDP(dc, (POINT *) &SpecifiedDestRect, 2);
+ IntLPtoDP(dc, (POINT *)lprc, 2);
}
BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
@@ -3288,10 +3250,10 @@ NtGdiExtTextOutW(
if ((fuOptions & ETO_OPAQUE) && lprc)
{
- DestRect.left = SpecifiedDestRect.left + dc->ptlDCOrig.x;
- DestRect.top = SpecifiedDestRect.top + dc->ptlDCOrig.y;
- DestRect.right = SpecifiedDestRect.right + dc->ptlDCOrig.x;
- DestRect.bottom = SpecifiedDestRect.bottom + dc->ptlDCOrig.y;
+ DestRect.left = lprc->left + dc->ptlDCOrig.x;
+ DestRect.top = lprc->top + dc->ptlDCOrig.y;
+ DestRect.right = lprc->right + dc->ptlDCOrig.x;
+ DestRect.bottom = lprc->bottom + dc->ptlDCOrig.y;
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
IntEngBitBlt(
&BitmapObj->SurfObj,
@@ -3405,7 +3367,7 @@ NtGdiExtTextOutW(
if (NULL != Dx)
{
Start = Count < 2 ? 0 : Count - 2;
- TextWidth = Count < 2 ? 0 : (Dx[Count - 2] << 6);
+ TextWidth = Count < 2 ? 0 : (Dx[(Count-2)<= SpecifiedDestRect.right + dc->ptlDCOrig.x)
+ DestRect.right >= lprc->right + dc->ptlDCOrig.x)
{
// We do the check '>=' instead of '>' to possibly save an iteration
// through this loop, since it's breaking after the drawing is done,
// and x is always incremented.
- DestRect.right = SpecifiedDestRect.right + dc->ptlDCOrig.x;
+ DestRect.right = lprc->right + dc->ptlDCOrig.x;
DoBreak = TRUE;
}
@@ -3638,7 +3600,7 @@ NtGdiExtTextOutW(
}
else
{
- TextLeft += Dx[i] << 6;
+ TextLeft += Dx[i< 0xFFFF) || (Count > 0 && UnsafeString == NULL))
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if (Count > 0)
+ {
+ /* Calculate buffer size for string and Dx values */
+ BufSize = StringSize = Count * sizeof(WCHAR);
+ if (UnsafeDx)
+ {
+ /* If ETO_PDY is specified, we have pairs of INTs */
+ DxSize = (Count * sizeof(INT)) * (fuOptions & ETO_PDY ? 2 : 1);
+ BufSize += DxSize;
+ }
+
+ /* Check if our local buffer is large enough */
+ if (BufSize > STACK_TEXT_BUFFER_SIZE)
+ {
+ /* It's not, allocate a temp buffer */
+ Buffer = ExAllocatePoolWithTag(PagedPool, BufSize, TAG_GDITEXT);
+ if (!Buffer)
+ {
+ return FALSE;
+ }
+ }
+
+ /* Probe and copy user mode data to the buffer */
+ _SEH2_TRY
+ {
+ /* Probe and copy the string */
+ ProbeForRead(UnsafeString, StringSize, 1);
+ SafeString = Buffer;
+ memcpy((PVOID)SafeString, UnsafeString, StringSize);
+
+ /* If we have Dx values... */
+ if (UnsafeDx)
+ {
+ /* ... probe and copy them */
+ ProbeForRead(UnsafeDx, DxSize, 1);
+ SafeDx = (LPINT)(((ULONG_PTR)Buffer) + StringSize);
+ memcpy(SafeDx, UnsafeDx, DxSize);
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END
+ if (!NT_SUCCESS(Status))
+ {
+ goto cleanup;
+ }
+ }
+
+ /* If we have a rect, copy it */
+ if (UnsafeRect)
+ {
+ _SEH2_TRY
+ {
+ ProbeForRead(UnsafeRect, sizeof(RECT), 1);
+ SafeRect = *UnsafeRect;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END
+ if (!NT_SUCCESS(Status))
+ {
+ goto cleanup;
+ }
+ }
+
+ /* Finally call the internal routine */
+ Result = GreExtTextOutW(hDC,
+ XStart,
+ YStart,
+ fuOptions,
+ &SafeRect,
+ SafeString,
+ Count,
+ SafeDx,
+ dwCodePage);
+
+cleanup:
+ /* If we allocated a buffer, free it */
+ if (Buffer != LocalBuffer)
+ {
+ ExFreePoolWithTag(Buffer, TAG_GDITEXT);
+ }
+
+ return Result;;
+}
+
+
/*
* @implemented
*/
diff --git a/reactos/tools/rbuild/automaticdependency.cpp b/reactos/tools/rbuild/automaticdependency.cpp
index ac13ac18c90..2f3aa850ed5 100644
--- a/reactos/tools/rbuild/automaticdependency.cpp
+++ b/reactos/tools/rbuild/automaticdependency.cpp
@@ -60,7 +60,7 @@ SourceFile::Open ()
if ( !f )
throw FileNotFoundException ( filename );
- if ( fstat ( fileno ( f ), &statbuf ) != 0 )
+ if ( fstat ( _fileno ( f ), &statbuf ) != 0 )
{
fclose ( f );
throw AccessDeniedException ( filename );
diff --git a/reactos/tools/rbuild/backend/backend.cpp b/reactos/tools/rbuild/backend/backend.cpp
index c7227684553..51ae59c05b4 100644
--- a/reactos/tools/rbuild/backend/backend.cpp
+++ b/reactos/tools/rbuild/backend/backend.cpp
@@ -32,7 +32,7 @@ Backend::Factory::ref = 0;
Backend::Factory::Factory ( const std::string& name_, const std::string& description_ )
{
string name(name_);
- strlwr ( &name[0] );
+ _strlwr ( &name[0] );
if ( !ref++ )
factories = new map;
(*factories)[name] = this;
@@ -55,7 +55,7 @@ Backend::Factory::Create ( const string& name,
Configuration& configuration )
{
string sname ( name );
- strlwr ( &sname[0] );
+ _strlwr ( &sname[0] );
if ( !factories || !factories->size () )
throw InvalidOperationException ( __FILE__,
__LINE__,
diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
index 9648bc421e8..5c6c5cf85d9 100644
--- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
+++ b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
@@ -268,7 +268,7 @@ CBBackend::_get_object_files ( const Module& module, vector& out) const
string::size_type pos = file.find_last_of (sSep);
if ( pos != string::npos )
file.erase ( 0, pos+1 );
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if ( !_stricmp ( Right(file,3).c_str(), ".rc" ) )
file = ReplaceExtension ( file, ".res" );
else
file = ReplaceExtension ( file, ".obj" );
@@ -429,7 +429,7 @@ CBBackend::_generate_cbproj ( const Module& module )
string fullpath = files[i]->file.relative_path + sSep + files[i]->file.name;
string file = string(".") + &fullpath[cbproj_path.size()];
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if ( !_stricmp ( Right(file,3).c_str(), ".rc" ) )
resource_files.push_back ( file );
else
source_files.push_back ( file );
diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp
index ae63c0531b5..ad251356d3e 100644
--- a/reactos/tools/rbuild/backend/mingw/mingw.cpp
+++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp
@@ -625,7 +625,7 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
if ( !f )
throw FileNotFoundException ( NormalizeFilename ( xmlbuildfile.topIncludeFilename ) );
- if ( fstat ( fileno ( f ), &statbuf ) != 0 )
+ if ( fstat ( _fileno ( f ), &statbuf ) != 0 )
{
fclose ( f );
throw AccessDeniedException ( NormalizeFilename ( xmlbuildfile.topIncludeFilename ) );
@@ -1068,7 +1068,7 @@ MingwBackend::DetectPipeSupport ()
{
usePipe = (exitcode == 0);
fclose ( f );
- unlink ( pipe_detectionObjectFilename.c_str () );
+ _unlink ( pipe_detectionObjectFilename.c_str () );
}
else
usePipe = false;
@@ -1101,7 +1101,7 @@ MingwBackend::DetectPCHSupport ()
{
use_pch = true;
fclose ( f );
- unlink ( path.c_str () );
+ _unlink ( path.c_str () );
}
else
use_pch = false;
diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
index d6c0022f357..874cec5d197 100644
--- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
+++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
@@ -69,7 +69,7 @@ string
GetTargetMacro ( const Module& module, bool with_dollar )
{
string s ( module.name );
- strupr ( &s[0] );
+ _strupr ( &s[0] );
s += "_TARGET";
if ( with_dollar )
return ssprintf ( "$(%s)", s.c_str() );
@@ -2406,13 +2406,13 @@ MingwAddCRTLibrary( Module &module )
const char * crtAttr = module.CRT.c_str ();
const char * crtLib = NULL;
- if ( stricmp ( crtAttr, "libc" ) == 0 )
+ if ( _stricmp ( crtAttr, "libc" ) == 0 )
crtLib = "crt";
- else if ( stricmp ( crtAttr, "msvcrt" ) == 0 )
+ else if ( _stricmp ( crtAttr, "msvcrt" ) == 0 )
crtLib = "msvcrt";
- else if ( stricmp ( crtAttr, "libcntpr" ) == 0 )
+ else if ( _stricmp ( crtAttr, "libcntpr" ) == 0 )
crtLib = "libcntpr";
- else if ( stricmp ( crtAttr, "ntdll" ) == 0 )
+ else if ( _stricmp ( crtAttr, "ntdll" ) == 0 )
crtLib = "ntdll";
if ( crtLib )
diff --git a/reactos/tools/rbuild/backend/msvc/msvc.cpp b/reactos/tools/rbuild/backend/msvc/msvc.cpp
index aa29317a968..573fc364db0 100644
--- a/reactos/tools/rbuild/backend/msvc/msvc.cpp
+++ b/reactos/tools/rbuild/backend/msvc/msvc.cpp
@@ -340,7 +340,7 @@ MSVCBackend::_get_object_files ( const Module& module, vector& out) cons
string::size_type pos = file.find_last_of (DEF_SSEP);
if ( pos != string::npos )
file.erase ( 0, pos+1 );
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if ( !_stricmp ( Right(file,3).c_str(), ".rc" ) )
file = ReplaceExtension ( file, ".res" );
else
file = ReplaceExtension ( file, ".obj" );
diff --git a/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp b/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp
index b437e6d49cb..1a7d171dd94 100644
--- a/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp
+++ b/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp
@@ -108,11 +108,11 @@ MSVCBackend::_generate_dsp ( const Module& module )
string file = path + std::string("\\") + files[i]->file.name;
source_files.push_back ( file );
- if ( !stricmp ( Right(file,2).c_str(), ".c" ) )
+ if ( !_stricmp ( Right(file,2).c_str(), ".c" ) )
c_srcs.push_back ( file );
- if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
+ if ( !_stricmp ( Right(file,2).c_str(), ".h" ) )
header_files.push_back ( file );
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if ( !_stricmp ( Right(file,3).c_str(), ".rc" ) )
resource_files.push_back ( file );
}
const vector& incs = data.includes;
diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
index ed744fbf064..ac1059d0bca 100644
--- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
+++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
@@ -159,9 +159,9 @@ MSVCBackend::_generate_vcproj ( const Module& module )
module.output->relative_path );
string file = path + std::string("\\") + files[i]->file.name;
- if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+ if ( !_stricmp ( Right(file,3).c_str(), ".rc" ) )
resource_files.push_back ( file );
- else if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
+ else if ( !_stricmp ( Right(file,2).c_str(), ".h" ) )
header_files.push_back ( file );
else
source_files.push_back ( file );
diff --git a/reactos/tools/rbuild/compilationunit.cpp b/reactos/tools/rbuild/compilationunit.cpp
index 35d0311fea0..81eb387f550 100644
--- a/reactos/tools/rbuild/compilationunit.cpp
+++ b/reactos/tools/rbuild/compilationunit.cpp
@@ -88,7 +88,7 @@ CompilationUnit::HasFileWithExtension ( const std::string& extension ) const
{
const File& file = *files[i];
string fileExtension = GetExtension ( file.file );
- if ( !stricmp ( fileExtension.c_str (), extension.c_str () ) )
+ if ( !_stricmp ( fileExtension.c_str (), extension.c_str () ) )
return true;
}
return false;
diff --git a/reactos/tools/rbuild/directory.cpp b/reactos/tools/rbuild/directory.cpp
index 381328398f3..9b9ce3e2a68 100644
--- a/reactos/tools/rbuild/directory.cpp
+++ b/reactos/tools/rbuild/directory.cpp
@@ -26,7 +26,7 @@
#endif//_MSC_VER
#ifdef WIN32
-#define MKDIR(s) mkdir(s)
+#define MKDIR(s) _mkdir(s)
#else
#define MKDIR(s) mkdir(s, 0755)
#endif
diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp
index b0670e2237f..64823bbdf0b 100644
--- a/reactos/tools/rbuild/module.cpp
+++ b/reactos/tools/rbuild/module.cpp
@@ -238,9 +238,9 @@ bool Module::GetBooleanAttribute ( const XMLElement& moduleNode, const char * na
if ( att != NULL )
{
const char* p = att->value.c_str();
- if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
+ if ( !_stricmp ( p, "true" ) || !_stricmp ( p, "yes" ) )
return true;
- else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
+ else if ( !_stricmp ( p, "false" ) || !_stricmp ( p, "no" ) )
return false;
else
{
@@ -358,26 +358,26 @@ Module::Module ( const Project& project,
{
CRT = att->value;
- if ( stricmp ( CRT.c_str (), "auto" ) == 0 )
+ if ( _stricmp ( CRT.c_str (), "auto" ) == 0 )
CRT = GetDefaultModuleCRT ();
}
else
CRT = GetDefaultModuleCRT ();
const char * crtAttr = CRT.c_str ();
- if ( crtAttr == NULL || stricmp ( crtAttr, "none" ) == 0 )
+ if ( crtAttr == NULL || _stricmp ( crtAttr, "none" ) == 0 )
dynamicCRT = false;
- else if ( stricmp ( crtAttr, "libc" ) == 0 )
+ else if ( _stricmp ( crtAttr, "libc" ) == 0 )
dynamicCRT = false;
- else if ( stricmp ( crtAttr, "msvcrt" ) == 0 )
+ else if ( _stricmp ( crtAttr, "msvcrt" ) == 0 )
dynamicCRT = true;
- else if ( stricmp ( crtAttr, "libcntpr" ) == 0 )
+ else if ( _stricmp ( crtAttr, "libcntpr" ) == 0 )
dynamicCRT = false;
- else if ( stricmp ( crtAttr, "ntdll" ) == 0 )
+ else if ( _stricmp ( crtAttr, "ntdll" ) == 0 )
dynamicCRT = true;
- else if ( stricmp ( crtAttr, "static" ) == 0 )
+ else if ( _stricmp ( crtAttr, "static" ) == 0 )
dynamicCRT = false;
- else if ( stricmp ( crtAttr, "dll" ) == 0 )
+ else if ( _stricmp ( crtAttr, "dll" ) == 0 )
dynamicCRT = true;
else
{
@@ -609,9 +609,9 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
const XMLAttribute* att = e.GetAttribute ( "first", false );
if ( att != NULL )
{
- if ( !stricmp ( att->value.c_str(), "true" ) )
+ if ( !_stricmp ( att->value.c_str(), "true" ) )
first = true;
- else if ( stricmp ( att->value.c_str(), "false" ) )
+ else if ( _stricmp ( att->value.c_str(), "false" ) )
{
throw XMLInvalidBuildFileException (
e.location,
@@ -626,11 +626,11 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
{
// check for c++ file
string ext = GetExtension ( e.value );
- if ( !stricmp ( ext.c_str(), ".cpp" ) )
+ if ( !_stricmp ( ext.c_str(), ".cpp" ) )
cplusplus = true;
- else if ( !stricmp ( ext.c_str(), ".cc" ) )
+ else if ( !_stricmp ( ext.c_str(), ".cc" ) )
cplusplus = true;
- else if ( !stricmp ( ext.c_str(), ".cxx" ) )
+ else if ( !_stricmp ( ext.c_str(), ".cxx" ) )
cplusplus = true;
}
File* pFile = new File ( directory,
@@ -1865,9 +1865,9 @@ Property::Property ( const XMLElement& node_,
if ( att != NULL )
{
const char* p = att->value.c_str();
- if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )
+ if ( !_stricmp ( p, "true" ) || !_stricmp ( p, "yes" ) )
isInternal = true;
- else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )
+ else if ( !_stricmp ( p, "false" ) || !_stricmp ( p, "no" ) )
isInternal = false;
else
{
diff --git a/reactos/tools/rbuild/rbuild.vcproj b/reactos/tools/rbuild/rbuild.vcproj
index 603e1443ef4..7e218d62a96 100644
--- a/reactos/tools/rbuild/rbuild.vcproj
+++ b/reactos/tools/rbuild/rbuild.vcproj
@@ -133,7 +133,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..,../../lib/inflib,../../include/reactos;../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;INFLIB_HOST;_CRT_SECURE_NO_WARNINGS"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;INFLIB_HOST;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
DefaultCharIsUnsigned="true"
diff --git a/reactos/tools/rbuild/testsupportcode.cpp b/reactos/tools/rbuild/testsupportcode.cpp
index 51d2039f81e..179e60b6210 100644
--- a/reactos/tools/rbuild/testsupportcode.cpp
+++ b/reactos/tools/rbuild/testsupportcode.cpp
@@ -293,7 +293,7 @@ TestSupportCode::GetTestDispatcherName ( string filename )
bool
TestSupportCode::IsTestFile ( string& filename ) const
{
- if ( stricmp ( GetFilename ( filename ).c_str (), "setup.c" ) == 0 )
+ if ( _stricmp ( GetFilename ( filename ).c_str (), "setup.c" ) == 0 )
return false;
return true;
}