Author: hbelusca
Date: Mon Jan 26 21:41:11 2015
New Revision: 66093
URL:
http://svn.reactos.org/svn/reactos?rev=66093&view=rev
Log:
Sync to trunk revision 66092.
Added:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/llmsort.c
- copied unchanged from r66092, trunk/reactos/tools/cdmake/llmsort.c
Removed:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/llmosrt.c
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/ (props changed)
branches/ReactOS-0.3.17-FOSDEM2015/reactos/base/applications/cacls/cacls.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/CMakeLists.txt
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/bootdata/CMakeLists.txt
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/CMakeLists.txt
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.S
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.asm
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/fatx.S
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/CMakeLists.txt
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/cache/blocklist.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/disk/partition.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/fs/ext2.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/disk.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/mm.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/mm/meminit.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/cmake/CMakeMacros.cmake
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/CMakeLists.txt
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/cdmake.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/pch.h
branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/main.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/msgqueue.c
branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/winpos.c
Propchange: branches/ReactOS-0.3.17-FOSDEM2015/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 26 21:41:11 2015
@@ -20,3 +20,4 @@
/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
/branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567
/branches/wlan-bringup:54809-54998
+/trunk/reactos:66079-66092
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/base/applications/cacls/cacls.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/base/applications/cacls/cacls.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/base/applications/cacls/cacls.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -18,6 +18,11 @@
*/
#include "precomp.h"
+
+/* command line options */
+BOOL OptionT = FALSE, OptionE = FALSE, OptionC = FALSE;
+BOOL OptionG = FALSE, OptionR = FALSE, OptionP = FALSE, OptionD = FALSE;
+LPCTSTR GUser, GPerm, RUser, PUser, PPerm, DUser;
static GENERIC_MAPPING FileGenericMapping =
{
@@ -512,92 +517,500 @@
return Ret;
}
+/* add a backslash at end to a path string if necessary */
+static VOID
+AddBackslash(LPTSTR FilePath)
+{
+ INT len = lstrlen(FilePath);
+ LPTSTR pch = CharPrev(FilePath, FilePath + len);
+ if (*pch != _T('\\'))
+ lstrcat(pch, _T("\\"));
+}
+
+static BOOL
+GetPathOfFile(LPTSTR FilePath, LPCTSTR pszFiles)
+{
+ TCHAR FullPath[MAX_PATH];
+ LPTSTR pch;
+ DWORD attrs;
+
+ lstrcpyn(FilePath, pszFiles, MAX_PATH);
+ pch = _tcsrchr(FilePath, _T('\\'));
+ if (pch != NULL)
+ {
+ *pch = 0;
+ if (!GetFullPathName(FilePath, MAX_PATH, FullPath, NULL))
+ {
+ PrintErrorMessage(GetLastError());
+ return FALSE;
+ }
+ lstrcpyn(FilePath, FullPath, MAX_PATH);
+
+ attrs = GetFileAttributes(FilePath);
+ if (attrs == 0xFFFFFFFF || !(attrs & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ PrintErrorMessage(ERROR_DIRECTORY);
+ return FALSE;
+ }
+ }
+ else
+ GetCurrentDirectory(MAX_PATH, FilePath);
+
+ AddBackslash(FilePath);
+ return TRUE;
+}
+
+static BOOL
+PrintDaclsOfFiles(LPCTSTR pszFiles)
+{
+ TCHAR FilePath[MAX_PATH];
+ WIN32_FIND_DATA FindData;
+ HANDLE hFind;
+ DWORD LastError;
+
+ /*
+ * get the file path
+ */
+ if (!GetPathOfFile(FilePath, pszFiles))
+ return FALSE;
+
+ /*
+ * search for the files
+ */
+ hFind = FindFirstFile(pszFiles, &FindData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return FALSE;
+
+ do
+ {
+ if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ if (!PrintFileDacl(FilePath, FindData.cFileName))
+ {
+ LastError = GetLastError();
+ if (LastError == ERROR_ACCESS_DENIED)
+ {
+ PrintErrorMessage(LastError);
+ if (!OptionC)
+ {
+ FindClose(hFind);
+ return FALSE;
+ }
+ }
+ else
+ break;
+ }
+ else
+ _tprintf(_T("\n"));
+ } while(FindNextFile(hFind, &FindData));
+ LastError = GetLastError();
+ FindClose(hFind);
+
+ if (LastError != ERROR_NO_MORE_FILES)
+ {
+ PrintErrorMessage(LastError);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOL
+GrantUserAccessRights(LPCTSTR FilePath, LPCTSTR File, LPCTSTR User, TCHAR Perm)
+{
+ /* TODO & FIXME */
+ switch(Perm)
+ {
+ case _T('R'): // Read
+ break;
+ case _T('W'): // Write
+ break;
+ case _T('C'): // Change (write)
+ break;
+ case _T('F'): // Full control
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+static BOOL
+ReplaceUserAccessRights(
+ LPCTSTR FilePath,
+ LPCTSTR File,
+ LPCTSTR User,
+ TCHAR Perm)
+{
+ /* TODO & FIXME */
+ switch(Perm)
+ {
+ case _T('N'): // None
+ break;
+ case _T('R'): // Read
+ break;
+ case _T('W'): // Write
+ break;
+ case _T('C'): // Change (write)
+ break;
+ case _T('F'): // Full control
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+static BOOL
+EditUserAccessRights(
+ LPCTSTR FilePath,
+ LPCTSTR File,
+ LPCTSTR User,
+ TCHAR Perm)
+{
+ /* TODO & FIXME */
+ switch(Perm)
+ {
+ case _T('N'): // None
+ break;
+ case _T('R'): // Read
+ break;
+ case _T('W'): // Write
+ break;
+ case _T('C'): // Change (write)
+ break;
+ case _T('F'): // Full control
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+static BOOL
+DenyUserAccess(LPCTSTR FilePath, LPCTSTR File, LPCTSTR User)
+{
+ /* TODO & FIXME */
+ return FALSE;
+}
+
+static BOOL
+RevokeUserAccessRights(LPCTSTR FilePath, LPCTSTR File, LPCTSTR User)
+{
+ /* TODO & FIXME */
+ return FALSE;
+}
+
+static BOOL
+ChangeFileACL(LPCTSTR FilePath, LPCTSTR File)
+{
+ if (OptionG)
+ {
+ /* Grant specified user access rights. */
+ GrantUserAccessRights(FilePath, File, GUser, *GPerm);
+ }
+
+ if (OptionP)
+ {
+ if (!OptionE)
+ {
+ /* Replace specified user's access rights. */
+ ReplaceUserAccessRights(FilePath, File, PUser, *PPerm);
+ }
+ else
+ {
+ /* Edit ACL instead of replacing it. */
+ EditUserAccessRights(FilePath, File, PUser, *PPerm);
+ }
+ }
+
+ if (OptionD)
+ {
+ /* Deny specified user access. */
+ DenyUserAccess(FilePath, File, DUser);
+ }
+
+ if (OptionR)
+ {
+ /* Revoke specified user's access rights. */
+ RevokeUserAccessRights(FilePath, File, RUser);
+ }
+
+ return TRUE;
+}
+
+static BOOL
+ChangeACLsOfFiles(LPCTSTR pszFiles)
+{
+ TCHAR FilePath[MAX_PATH];
+ HANDLE hFind;
+ WIN32_FIND_DATA FindData;
+ DWORD LastError;
+
+ /*
+ * get the file path
+ */
+ if (!GetPathOfFile(FilePath, pszFiles))
+ return FALSE;
+
+ /*
+ * search for files in current directory
+ */
+ hFind = FindFirstFile(pszFiles, &FindData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return FALSE;
+
+ do
+ {
+ if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ if (!ChangeFileACL(FilePath, FindData.cFileName))
+ {
+ LastError = GetLastError();
+ if (LastError == ERROR_ACCESS_DENIED)
+ {
+ PrintErrorMessage(LastError);
+ if (!OptionC)
+ {
+ FindClose(hFind);
+ return FALSE;
+ }
+ }
+ else
+ break;
+ }
+ } while(FindNextFile(hFind, &FindData));
+
+ LastError = GetLastError();
+ FindClose(hFind);
+
+ if (LastError != ERROR_NO_MORE_FILES)
+ {
+ PrintErrorMessage(LastError);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOL
+ChangeACLsOfFilesInCurDir(LPCTSTR pszFiles)
+{
+ HANDLE hFind;
+ WIN32_FIND_DATA FindData;
+ TCHAR szCurDir[MAX_PATH];
+ DWORD LastError;
+
+ /*
+ * get the file path (current directory)
+ */
+ GetCurrentDirectory(MAX_PATH, szCurDir);
+ AddBackslash(szCurDir);
+
+ /*
+ * search for files in current directory
+ */
+ hFind = FindFirstFile(pszFiles, &FindData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return FALSE;
+
+ do
+ {
+ if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ if (!ChangeFileACL(szCurDir, FindData.cFileName))
+ {
+ LastError = GetLastError();
+ if (LastError == ERROR_ACCESS_DENIED)
+ {
+ PrintErrorMessage(LastError);
+ if (!OptionC)
+ {
+ FindClose(hFind);
+ return FALSE;
+ }
+ }
+ else
+ break;
+ }
+ } while(FindNextFile(hFind, &FindData));
+
+ LastError = GetLastError();
+ FindClose(hFind);
+
+ if (LastError != ERROR_NO_MORE_FILES)
+ {
+ PrintErrorMessage(LastError);
+ return FALSE;
+ }
+
+ /*
+ * search for subdirectory in current directory
+ */
+ hFind = FindFirstFile(_T("*"), &FindData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return FALSE;
+ do
+ {
+ if (_tcscmp(FindData.cFileName, _T(".")) == 0 ||
+ _tcscmp(FindData.cFileName, _T("..")) == 0)
+ continue;
+
+ if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ GetCurrentDirectory(MAX_PATH, szCurDir);
+ if (SetCurrentDirectory(FindData.cFileName))
+ {
+ ChangeACLsOfFilesInCurDir(pszFiles);
+ SetCurrentDirectory(szCurDir);
+ }
+ else
+ {
+ LastError = GetLastError();
+ if (LastError == ERROR_ACCESS_DENIED)
+ {
+ PrintErrorMessage(LastError);
+ if (!OptionC)
+ {
+ FindClose(hFind);
+ return FALSE;
+ }
+ }
+ else
+ break;
+ }
+ }
+ } while(FindNextFile(hFind, &FindData));
+ LastError = GetLastError();
+ FindClose(hFind);
+
+ if (LastError != ERROR_NO_MORE_FILES)
+ {
+ PrintErrorMessage(LastError);
+ return FALSE;
+ }
+ return TRUE;
+}
int
__cdecl
_tmain(int argc, const TCHAR *argv[])
{
- if (argc < 2)
- {
+ INT i;
+ LPTSTR pch;
+ BOOL InvalidParameter = FALSE;
+
+ if (argc <= 1)
+ {
+ PrintHelp();
+ return 0;
+ }
+
+ /*
+ * parse command line options
+ */
+ for (i = 2; i < argc; i++)
+ {
+ if (lstrcmpi(argv[i], _T("/T")) == 0)
+ {
+ OptionT = TRUE;
+ }
+ else if (lstrcmpi(argv[i], _T("/E")) == 0)
+ {
+ OptionE = TRUE;
+ }
+ else if (lstrcmpi(argv[i], _T("/C")) == 0)
+ {
+ OptionC = TRUE;
+ }
+ else if (lstrcmpi(argv[i], _T("/G")) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ pch = _tcschr(argv[++i], _T(':'));
+ if (pch != NULL)
+ {
+ OptionG = TRUE;
+ *pch = 0;
+ GUser = argv[i];
+ GPerm = pch + 1;
+ continue;
+ }
+ }
+ InvalidParameter = TRUE;
+ break;
+ }
+ else if (lstrcmpi(argv[i], _T("/R")) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ RUser = argv[++i];
+ OptionR = TRUE;
+ continue;
+ }
+ InvalidParameter = TRUE;
+ break;
+ }
+ else if (lstrcmpi(argv[i], _T("/P")) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ pch = _tcschr(argv[++i], _T(':'));
+ if (pch != NULL)
+ {
+ OptionP = TRUE;
+ *pch = 0;
+ PUser = argv[i];
+ PPerm = pch + 1;
+ continue;
+ }
+ }
+ InvalidParameter = TRUE;
+ break;
+ }
+ else if (lstrcmpi(argv[i], _T("/D")) == 0)
+ {
+ if (i + 1 < argc)
+ {
+ OptionD = TRUE;
+ DUser = argv[++i];
+ continue;
+ }
+ InvalidParameter = TRUE;
+ break;
+ }
+ else
+ {
+ InvalidParameter = TRUE;
+ break;
+ }
+ }
+
+ if (InvalidParameter)
+ {
+ PrintErrorMessage(ERROR_INVALID_PARAMETER);
PrintHelp();
return 1;
}
+
+ /* /R is only valid with /E */
+ if (OptionR && !OptionE)
+ {
+ OptionR = FALSE;
+ }
+
+ PrintDaclsOfFiles(argv[1]);
+
+ if (OptionT)
+ {
+ ChangeACLsOfFilesInCurDir(argv[1]);
+ }
else
{
- TCHAR FullPath[MAX_PATH + 1];
- TCHAR *FilePart = NULL;
- WIN32_FIND_DATA FindData;
- HANDLE hFind;
- DWORD LastError;
-
- if (argc > 2)
- {
- /* FIXME - parse arguments */
- }
-
- /* get the full path of where we're searching in */
- if (GetFullPathName(argv[1],
- sizeof(FullPath) / sizeof(FullPath[0]),
- FullPath,
- &FilePart) != 0)
- {
- if (FilePart != NULL)
- *FilePart = _T('\0');
- }
- else
- goto Error;
-
- /* find the file(s) */
- hFind = FindFirstFile(argv[1],
- &FindData);
- if (hFind != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (!(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
- (_tcscmp(FindData.cFileName,
- _T(".")) &&
- _tcscmp(FindData.cFileName,
- _T(".."))))
- {
- if (argc > 2)
- {
- /* FIXME - edit or replace the descriptor */
- }
- else
- {
- if (!PrintFileDacl(FullPath,
- FindData.cFileName))
- {
- LastError = GetLastError();
-
- if (LastError == ERROR_ACCESS_DENIED)
- {
- PrintErrorMessage(LastError);
- }
- else
- break;
- }
- else
- _tprintf(_T("\n"));
- }
- }
- } while (FindNextFile(hFind,
- &FindData));
-
- FindClose(hFind);
-
- if (GetLastError() != ERROR_NO_MORE_FILES)
- {
- goto Error;
- }
- }
- else
- {
-Error:
- PrintErrorMessage(GetLastError());
- return 1;
- }
+ ChangeACLsOfFiles(argv[1]);
}
return 0;
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/CMakeLists.txt [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/CMakeLists.txt [iso-8859-1] Mon Jan 26
21:41:11 2015
@@ -26,8 +26,8 @@
VERBATIM)
##hybridcd
-#clear it out
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "")
+#clear it out and create the empty Desktop folder
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst "livecd/Profiles/Default
User/Desktop\n")
add_custom_target(hybridcd
COMMAND native-cdmake -j -m -b
${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin
@${CMAKE_CURRENT_BINARY_DIR}/hybridcd.lst REACTOS ${REACTOS_BINARY_DIR}/hybridcd.iso
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/bootdata/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/bootdata/CMakeLists.txt [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -63,21 +63,21 @@
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcdregtest/regtest.cmd DESTINATION
reactos/bin FOR all)
#autorun.inf
-add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun.inf DESTINATION root NO_CAB FOR all
hybridcd)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/autorun.inf DESTINATION root NO_CAB
NOT_IN_HYBRIDCD FOR all hybridcd)
#icon.ico
-add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB FOR all
hybridcd)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/icon.ico DESTINATION root NO_CAB
NOT_IN_HYBRIDCD FOR all hybridcd)
#readme.txt
-add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB FOR all
hybridcd)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION root NO_CAB
NOT_IN_HYBRIDCD FOR all hybridcd)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/readme.txt DESTINATION reactos FOR all)
#system.ini
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/system.ini DESTINATION reactos FOR all)
#freeldr.ini
-add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB
NAME_ON_CD freeldr.ini FOR bootcd regtest)
-add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd.ini DESTINATION root NAME_ON_CD
freeldr.ini FOR livecd)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/bootcd.ini DESTINATION root NO_CAB
NOT_IN_HYBRIDCD NAME_ON_CD freeldr.ini FOR bootcd regtest)
+add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/livecd.ini DESTINATION root NOT_IN_HYBRIDCD
NAME_ON_CD freeldr.ini FOR livecd)
add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hybridcd.ini DESTINATION root NAME_ON_CD
freeldr.ini FOR hybridcd)
#unattend
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/CMakeLists.txt [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -3,16 +3,16 @@
CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S
${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00)
CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S
${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
+ CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S
${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S
${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
- CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S
${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S
${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000)
CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S
${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 7000)
- add_cd_file(TARGET dosmbr DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin FOR all)
- add_cd_file(TARGET fat32 DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/fat32.bin FOR all)
- add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/fat.bin FOR all)
- add_cd_file(TARGET isoboot DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all hybridcd)
- add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all)
- add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR all)
+ add_cd_file(TARGET dosmbr DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin FOR bootcd)
+ add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR bootcd)
+ add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/fat.bin FOR bootcd)
+ add_cd_file(TARGET fat32 DESTINATION loader NO_CAB FILE
${CMAKE_CURRENT_BINARY_DIR}/fat32.bin FOR bootcd)
+ add_cd_file(TARGET isoboot DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FILE
${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all hybridcd)
+ add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FILE
${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR bootcd)
endif()
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.S
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.S [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.S [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -2,7 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Bootsector for ISO file system
* PURPOSE: Normal DOS boot sector
- * Ported to nasm from FreeDOS fdisk 1.2.0 by:
+ * Ported to NASM from FreeDOS fdisk 1.2.0 by:
* PROGRAMMERS: Casper Hornstrup (chorns(a)users.sourceforge.net)
*/
@@ -58,7 +58,7 @@
/*****************************************************************/
call print
- .asciz "no active partition found"
+ .asciz "No active partition found"
WAIT_FOR_REBOOT:
jmp WAIT_FOR_REBOOT
@@ -67,22 +67,22 @@
/*****************************************************************/
trouble_reading_drive:
call print
- .asciz "read error while reading drive"
+ .asciz "Read error while reading drive"
jmp WAIT_FOR_REBOOT
/*****************************************************************/
invalid_partition_code:
call print
- .asciz "partition signature != 55AA"
+ .asciz "Partition signature != 55AA"
jmp WAIT_FOR_REBOOT
/*****************************************************************/
active_partition_found:
-// call print
-// .asciz "loading active partition"
+// call print
+// .asciz "Loading active partition"
call read_boot_sector
@@ -135,16 +135,16 @@
LBABios:
// copy start address of partition to DAP
- mov ax, [di + 8]
- mov word ptr ds:[_bios_LBA_low], ax
- mov ax,[di + 8 + 2]
- mov word ptr ds:[_bios_LBA_high], ax
+ mov ax, [di + 8]
+ mov word ptr ds:[_bios_LBA_low], ax
+ mov ax,[di + 8 + 2]
+ mov word ptr ds:[_bios_LBA_high], ax
mov ax, HEX(4200) // regs.a.x = LBA_READ;
mov si, offset _bios_LBA_address_packet // regs.si = FP_OFF(&dap);
- int HEX(13)
- ret
+ int HEX(13)
+ ret
/*****************************************************************
* read disk, using standard BIOS
@@ -153,15 +153,15 @@
mov ax, HEX(0204) // regs.a.x = 0x0201;
mov bx, HEX(7c00) // regs.b.x = FP_OFF(buffer);
- /* regs.c.x =
+ /* regs.c.x =
((chs.Cylinder & 0xff) << 8) + ((chs.Cylinder & 0x300) >> 2)
+
; chs.Sector;
that was easy ;-) */
- mov cx, word ptr ds:[di + 2]
+ mov cx, word ptr ds:[di + 2]
mov dh, byte ptr ds:[di + 1] // regs.d.b.h = chs.Head;
// regs.es = FP_SEG(buffer);
- int HEX(13)
- ret
+ int HEX(13)
+ ret
/****** PRINT
* prints text after call to this function.
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.asm
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.asm [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/dosmbr.asm [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -1,7 +1,7 @@
;
-; normal DOS boot sector
+; Normal DOS boot sector
;
-; Ported to nasm from FreeDOS fdisk 1.2.0 by:
+; Ported to NASM from FreeDOS fdisk 1.2.0 by:
; Casper Hornstrup (chorns(a)users.sourceforge.net)
;
@@ -53,7 +53,7 @@
;*****************************************************************
call print
- db 'no active partition found',0
+ db 'No active partition found',0
WAIT_FOR_REBOOT:
jmp $
@@ -62,14 +62,14 @@
;*****************************************************************
trouble_reading_drive:
call print
- db 'read error while reading drive',0
+ db 'Read error while reading drive',0
jmp WAIT_FOR_REBOOT
;*****************************************************************
invalid_partition_code:
call print
- db 'partition signature != 55AA',0
+ db 'Partition signature != 55AA',0
jmp WAIT_FOR_REBOOT
@@ -78,7 +78,7 @@
active_partition_found:
; call print
-; db 'loading active partition',0
+; db 'Loading active partition',0
call read_boot_sector
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/fatx.S
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/fatx.S [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/bootsect/fatx.S [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -7,6 +7,7 @@
* Timo Kreuzer
*/
+#define DISKREADBUFFER HEX(8E000)
/*
* Layout of a FAT volume:
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -236,7 +236,7 @@
# rename freeldr on livecd to setupldr.sys because isoboot.bin looks for setupldr.sys
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION
loader NO_CAB FOR bootcd regtest)
-add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION
loader NO_CAB FOR livecd hybridcd NAME_ON_CD setupldr.sys)
+add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION
loader NO_CAB NOT_IN_HYBRIDCD FOR livecd hybridcd NAME_ON_CD setupldr.sys)
concatenate_files(
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -307,10 +307,10 @@
{
NodeNumber = (UCHAR)i;
- x = PnpBiosGetDeviceNode(&NodeNumber, (PVOID)DISKREADBUFFER);
+ x = PnpBiosGetDeviceNode(&NodeNumber, DiskReadBuffer);
if (x == 0)
{
- DeviceNode = (PCM_PNP_BIOS_DEVICE_NODE)DISKREADBUFFER;
+ DeviceNode = (PCM_PNP_BIOS_DEVICE_NODE)DiskReadBuffer;
TRACE("Node: %u Size %u (0x%x)\n",
DeviceNode->Node,
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -42,6 +42,8 @@
static CHAR Hex[] = "0123456789abcdef";
UCHAR PcBiosDiskCount = 0;
CHAR PcDiskIdentifier[32][20];
+PVOID DiskReadBuffer;
+SIZE_T DiskReadBufferSize;
static ARC_STATUS DiskClose(ULONG FileId)
@@ -119,7 +121,7 @@
ULONGLONG SectorOffset;
TotalSectors = (N + Context->SectorSize - 1) / Context->SectorSize;
- MaxSectors = PcDiskReadBufferSize / Context->SectorSize;
+ MaxSectors = DiskReadBufferSize / Context->SectorSize;
SectorOffset = Context->SectorNumber + Context->SectorOffset;
ret = 1;
@@ -134,7 +136,7 @@
Context->DriveNumber,
SectorOffset,
ReadSectors,
- (PVOID)DISKREADBUFFER);
+ DiskReadBuffer);
if (!ret)
break;
@@ -142,7 +144,7 @@
if (Length > N)
Length = N;
- RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, Length);
+ RtlCopyMemory(Ptr, DiskReadBuffer, Length);
Ptr += Length;
N -= Length;
@@ -197,14 +199,14 @@
PCHAR Identifier = PcDiskIdentifier[DriveNumber - 0x80];
/* Read the MBR */
- if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
+ if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
{
ERR("Reading MBR failed\n");
return;
}
- Buffer = (ULONG*)DISKREADBUFFER;
- Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
+ Buffer = (ULONG*)DiskReadBuffer;
+ Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
@@ -288,13 +290,13 @@
* harddisks. So, we set the buffer to known contents first, then try to
* read. If the BIOS reports success but the buffer contents haven't
* changed then we fail anyway */
- memset((PVOID) DISKREADBUFFER, 0xcd, 512);
- while (MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
+ memset(DiskReadBuffer, 0xcd, 512);
+ while (MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
{
Changed = FALSE;
for (i = 0; ! Changed && i < 512; i++)
{
- Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
+ Changed = ((PUCHAR)DiskReadBuffer)[i] != 0xcd;
}
if (! Changed)
{
@@ -310,7 +312,7 @@
DiskCount++;
DriveNumber++;
- memset((PVOID) DISKREADBUFFER, 0xcd, 512);
+ memset(DiskReadBuffer, 0xcd, 512);
}
DiskReportError(TRUE);
@@ -326,13 +328,13 @@
ULONG Checksum = 0;
/* Read the MBR */
- if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1,
(PVOID)DISKREADBUFFER))
+ if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, DiskReadBuffer))
{
ERR("Reading MBR failed\n");
return FALSE;
}
- Buffer = (ULONG*)DISKREADBUFFER;
+ Buffer = (ULONG*)DiskReadBuffer;
/* Calculate the MBR checksum */
for (i = 0; i < 2048 / sizeof(ULONG); i++) Checksum += Buffer[i];
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -29,32 +29,11 @@
#define MAX_BIOS_DESCRIPTORS 32
-#define STACK_BASE_PAGE (STACKLOW / PAGE_SIZE)
-#define FREELDR_BASE_PAGE (FREELDR_BASE / PAGE_SIZE)
-#define DISKBUF_BASE_PAGE (DISKREADBUFFER / PAGE_SIZE)
-
-#define STACK_PAGE_COUNT (FREELDR_BASE_PAGE - STACK_BASE_PAGE)
-#define FREELDR_PAGE_COUNT (DISKBUF_BASE_PAGE - FREELDR_BASE_PAGE)
-#define DISKBUF_PAGE_COUNT (0x10)
-#define BIOSBUF_PAGE_COUNT (1)
-
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS];
ULONG PcBiosMapCount;
-ULONG PcDiskReadBufferSize;
-
-FREELDR_MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS + 1] =
-{
- { LoaderFirmwarePermanent, 0x00, 1 }, // realmode int vectors
- { LoaderFirmwareTemporary, 0x01, STACK_BASE_PAGE - 1 }, // freeldr
stack, cmdline, BIOS call buffer
- { LoaderOsloaderStack, STACK_BASE_PAGE, FREELDR_BASE_PAGE - STACK_BASE_PAGE },
// prot mode stack.
- { LoaderLoadedProgram, FREELDR_BASE_PAGE, FREELDR_PAGE_COUNT }, // freeldr
image
- { LoaderFirmwareTemporary, DISKBUF_BASE_PAGE, DISKBUF_PAGE_COUNT }, // Disk read
buffer for int 13h. DISKREADBUFFER
- { LoaderFirmwarePermanent, 0x9F, 0x1 }, // EBDA
- { LoaderFirmwarePermanent, 0xA0, 0x50 }, // ROM / Video
- { LoaderSpecialMemory, 0xF0, 0x10 }, // ROM / Video
- { LoaderSpecialMemory, 0xFFF, 1 }, // unusable memory
- { 0, 0, 0 }, // end of map
-};
+
+FREELDR_MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS + 1];
+ULONG PcMapCount;
ULONG
AddMemoryDescriptor(
@@ -186,38 +165,12 @@
}
static
-ULONG
-PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
+BOOLEAN
+GetEbdaLocation(
+ PULONG BaseAddress,
+ PULONG Size)
{
REGS Regs;
- ULONG MapCount = 0;
- ULONGLONG RealBaseAddress, RealSize;
- TYPE_OF_MEMORY MemoryType;
- ULONG Size;
- ASSERT(PcBiosMapCount == 0);
-
- TRACE("GetBiosMemoryMap()\n");
-
- /* Make sure the usable memory is large enough. To do this we check the 16
- bit value at address 0x413 inside the BDA, which gives us the usable size
- in KB */
- Size = (*(PUSHORT)(ULONG_PTR)0x413) * 1024;
- if (Size < DISKREADBUFFER || Size - DISKREADBUFFER < MIN_DISKREADBUFFER_SIZE)
- {
- FrLdrBugCheckWithMessage(
- MEMORY_INIT_FAILURE,
- __FILE__,
- __LINE__,
- "The BIOS reported a usable memory range up to 0x%x, which is too
small!\n\n"
- "If you see this, please report to the ReactOS team!",
- Size);
- }
- PcDiskReadBufferSize = (Size - DISKREADBUFFER) & ~0xfff;
- if (PcDiskReadBufferSize > MAX_DISKREADBUFFER_SIZE)
- {
- PcDiskReadBufferSize = MAX_DISKREADBUFFER_SIZE;
- }
- TRACE("PcDiskReadBufferSize=0x%x\n", PcDiskReadBufferSize);
/* Get the address of the Extended BIOS Data Area (EBDA).
* Int 15h, AH=C1h
@@ -232,35 +185,44 @@
Int386(0x15, &Regs, &Regs);
/* If the function fails, there is no EBDA */
- if (INT386_SUCCESS(Regs))
- {
- /* Check if this is high enough */
- ULONG EbdaBase = (ULONG)Regs.w.es << 4;
- if (EbdaBase < DISKREADBUFFER || EbdaBase - DISKREADBUFFER <
MIN_DISKREADBUFFER_SIZE)
- {
- FrLdrBugCheckWithMessage(
- MEMORY_INIT_FAILURE,
- __FILE__,
- __LINE__,
- "The location of your EBDA is 0x%lx, which is too low!\n\n"
- "If you see this, please report to the ReactOS team!",
- EbdaBase);
- }
- if (((EbdaBase - DISKREADBUFFER) & ~0xfff) < PcDiskReadBufferSize)
- {
- PcDiskReadBufferSize = (EbdaBase - DISKREADBUFFER) & ~0xfff;
- TRACE("After EBDA check, PcDiskReadBufferSize=0x%x\n",
PcDiskReadBufferSize);
- }
-
- /* Calculate the (max) size of the EBDA */
- Size = 0xA0000 - EbdaBase;
-
- /* Add the descriptor */
- MapCount = AddMemoryDescriptor(PcMemoryMap,
- MAX_BIOS_DESCRIPTORS,
- (EbdaBase / MM_PAGE_SIZE),
- (Size / MM_PAGE_SIZE),
- LoaderFirmwarePermanent);
+ if (!INT386_SUCCESS(Regs))
+ {
+ return FALSE;
+ }
+
+ /* Get Base address and (maximum) size */
+ *BaseAddress = (ULONG)Regs.w.es << 4;
+ *Size = 0xA0000 - *BaseAddress;
+ return TRUE;
+}
+
+static
+ULONG
+PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
+{
+ REGS Regs;
+ ULONGLONG RealBaseAddress, EndAddress, RealSize;
+ TYPE_OF_MEMORY MemoryType;
+ ULONG Size, RequiredSize;
+ ASSERT(PcBiosMapCount == 0);
+
+ TRACE("GetBiosMemoryMap()\n");
+
+ /* Make sure the usable memory is large enough. To do this we check the 16
+ bit value at address 0x413 inside the BDA, which gives us the usable size
+ in KB */
+ Size = (*(PUSHORT)(ULONG_PTR)0x413) * 1024;
+ RequiredSize = FREELDR_BASE + FrLdrImageSize + PAGE_SIZE;
+ if (Size < RequiredSize)
+ {
+ FrLdrBugCheckWithMessage(
+ MEMORY_INIT_FAILURE,
+ __FILE__,
+ __LINE__,
+ "The BIOS reported a usable memory range up to 0x%x, which is too
small!\n"
+ "Required size is 0x%x\n\n"
+ "If you see this, please report to the ReactOS team!",
+ Size, RequiredSize);
}
/* Int 15h AX=E820h
@@ -322,13 +284,24 @@
{
MemoryType = LoaderFree;
- /* Align up base of memory area */
- RealBaseAddress = PcBiosMemoryMap[PcBiosMapCount].BaseAddress &
~(MM_PAGE_SIZE - 1ULL);
-
- /* Calculate the length after aligning the base */
- RealSize = PcBiosMemoryMap[PcBiosMapCount].BaseAddress +
- PcBiosMemoryMap[PcBiosMapCount].Length - RealBaseAddress;
- RealSize = (RealSize + MM_PAGE_SIZE - 1) & ~(MM_PAGE_SIZE - 1ULL);
+ /* Align up base of memory range */
+ RealBaseAddress = ALIGN_UP_BY(PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PAGE_SIZE);
+
+ /* Calculate aligned EndAddress */
+ EndAddress = PcBiosMemoryMap[PcBiosMapCount].BaseAddress +
+ PcBiosMemoryMap[PcBiosMapCount].Length;
+ EndAddress = ALIGN_DOWN_BY(EndAddress, PAGE_SIZE);
+
+ /* Check if there is anything left */
+ if (EndAddress <= RealBaseAddress)
+ {
+ /* This doesn't span any page, so continue with next range */
+ continue;
+ }
+
+ /* Calculate the length of the aligned range */
+ RealSize = EndAddress - RealBaseAddress;
}
else
{
@@ -338,18 +311,20 @@
MemoryType = LoaderSpecialMemory;
/* Align down base of memory area */
- RealBaseAddress = PcBiosMemoryMap[PcBiosMapCount].BaseAddress &
~(MM_PAGE_SIZE - 1ULL);
+ RealBaseAddress = ALIGN_DOWN_BY(PcBiosMemoryMap[PcBiosMapCount].BaseAddress,
+ PAGE_SIZE);
+
/* Calculate the length after aligning the base */
RealSize = PcBiosMemoryMap[PcBiosMapCount].BaseAddress +
PcBiosMemoryMap[PcBiosMapCount].Length - RealBaseAddress;
- RealSize = (RealSize + MM_PAGE_SIZE - 1) & ~(MM_PAGE_SIZE - 1ULL);
+ RealSize = ALIGN_UP_BY(RealSize, PAGE_SIZE);
}
/* Check if we can add this descriptor */
- if ((RealSize >= MM_PAGE_SIZE) && (MapCount < MaxMemoryMapSize))
+ if ((RealSize >= MM_PAGE_SIZE) && (PcMapCount < MaxMemoryMapSize))
{
/* Add the descriptor */
- MapCount = AddMemoryDescriptor(PcMemoryMap,
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
MAX_BIOS_DESCRIPTORS,
(PFN_NUMBER)(RealBaseAddress / MM_PAGE_SIZE),
(PFN_NUMBER)(RealSize / MM_PAGE_SIZE),
@@ -366,12 +341,72 @@
TRACE("End Of System Memory Map!\n\n");
break;
}
-
- }
-
- return MapCount;
-}
-
+ }
+
+ TRACE("GetBiosMemoryMap end, PcBiosMapCount = %ld\n", PcBiosMapCount);
+ return PcBiosMapCount;
+}
+
+VOID
+ReserveMemory(
+ ULONG_PTR BaseAddress,
+ SIZE_T Size,
+ TYPE_OF_MEMORY MemoryType,
+ PCHAR Usage)
+{
+ ULONG_PTR BasePage, PageCount;
+ ULONG i;
+
+ BasePage = BaseAddress / PAGE_SIZE;
+ PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(BaseAddress, Size);
+
+ for (i = 0; i < PcMapCount; i++)
+ {
+ /* Check for conflicting descriptor */
+ if ((PcMemoryMap[i].BasePage < BasePage + PageCount) &&
+ (PcMemoryMap[i].BasePage + PcMemoryMap[i].PageCount > BasePage))
+ {
+ /* Check if the memory is free */
+ if (PcMemoryMap[i].MemoryType != LoaderFree)
+ {
+ FrLdrBugCheckWithMessage(
+ MEMORY_INIT_FAILURE,
+ __FILE__,
+ __LINE__,
+ "Failed to reserve memory in the range 0x%Ix - 0x%Ix for
%s",
+ BaseAddress,
+ Size,
+ Usage);
+ }
+ }
+ }
+
+ /* Add the memory descriptor */
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
+ MAX_BIOS_DESCRIPTORS,
+ BasePage,
+ PageCount,
+ MemoryType);
+}
+
+VOID
+SetMemory(
+ ULONG_PTR BaseAddress,
+ SIZE_T Size,
+ TYPE_OF_MEMORY MemoryType)
+{
+ ULONG_PTR BasePage, PageCount;
+
+ BasePage = BaseAddress / PAGE_SIZE;
+ PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(BaseAddress, Size);
+
+ /* Add the memory descriptor */
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
+ MAX_BIOS_DESCRIPTORS,
+ BasePage,
+ PageCount,
+ MemoryType);
+}
PFREELDR_MEMORY_DESCRIPTOR
PcMemGetMemoryMap(ULONG *MemoryMapSize)
@@ -379,13 +414,16 @@
ULONG i, EntryCount;
ULONG ExtendedMemorySizeAtOneMB;
ULONG ExtendedMemorySizeAtSixteenMB;
+ ULONG EbdaBase, EbdaSize;
+ TRACE("PcMemGetMemoryMap()\n");
EntryCount = PcMemGetBiosMemoryMap(PcMemoryMap, MAX_BIOS_DESCRIPTORS);
/* If the BIOS didn't provide a memory map, synthesize one */
- if (0 == EntryCount)
- {
- GetExtendedMemoryConfiguration(&ExtendedMemorySizeAtOneMB,
&ExtendedMemorySizeAtSixteenMB);
+ if (EntryCount == 0)
+ {
+ GetExtendedMemoryConfiguration(&ExtendedMemorySizeAtOneMB,
+ &ExtendedMemorySizeAtSixteenMB);
/* Conventional memory */
AddMemoryDescriptor(PcMemoryMap,
@@ -395,7 +433,7 @@
LoaderFree);
/* Extended memory */
- EntryCount = AddMemoryDescriptor(PcMemoryMap,
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
MAX_BIOS_DESCRIPTORS,
1024 * 1024 / PAGE_SIZE,
ExtendedMemorySizeAtOneMB * 1024 / PAGE_SIZE,
@@ -404,16 +442,65 @@
if (ExtendedMemorySizeAtSixteenMB != 0)
{
/* Extended memory at 16MB */
- EntryCount = AddMemoryDescriptor(PcMemoryMap,
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
MAX_BIOS_DESCRIPTORS,
0x1000000 / PAGE_SIZE,
ExtendedMemorySizeAtSixteenMB * 64 * 1024 /
PAGE_SIZE,
LoaderFree);
}
- }
+
+ /* Check if we have an EBDA and get it's location */
+ if (GetEbdaLocation(&EbdaBase, &EbdaSize))
+ {
+ /* Add the descriptor */
+ PcMapCount = AddMemoryDescriptor(PcMemoryMap,
+ MAX_BIOS_DESCRIPTORS,
+ (EbdaBase / PAGE_SIZE),
+ ADDRESS_AND_SIZE_TO_SPAN_PAGES(EbdaBase,
EbdaSize),
+ LoaderFirmwarePermanent);
+ }
+ }
+
+ /* Setup some protected ranges */
+ SetMemory(0x000000, 0x01000, LoaderFirmwarePermanent); // Realmode IVT / BDA
+ SetMemory(0x0A0000, 0x50000, LoaderFirmwarePermanent); // Video memory
+ SetMemory(0x0F0000, 0x10000, LoaderSpecialMemory); // ROM
+ SetMemory(0xFFF000, 0x01000, LoaderSpecialMemory); // unusable memory (do we really
need this?)
+
+ /* Reserve some static ranges for freeldr */
+ ReserveMemory(0x1000, STACKLOW - 0x1000, LoaderFirmwareTemporary, "BIOS
area");
+ ReserveMemory(STACKLOW, STACKADDR - STACKLOW, LoaderOsloaderStack, "FreeLdr
stack");
+ ReserveMemory(FREELDR_BASE, FrLdrImageSize, LoaderLoadedProgram, "FreeLdr
image");
+
+ /* Default to 1 page above freeldr for the disk read buffer */
+ DiskReadBuffer = (PUCHAR)ALIGN_UP_BY(FREELDR_BASE + FrLdrImageSize, PAGE_SIZE);
+ DiskReadBufferSize = PAGE_SIZE;
+
+ /* Scan for free range above freeldr image */
+ for (i = 0; i < PcMapCount; i++)
+ {
+ if ((PcMemoryMap[i].BasePage > (FREELDR_BASE / PAGE_SIZE)) &&
+ (PcMemoryMap[i].MemoryType == LoaderFree))
+ {
+ /* Use this range for the disk read buffer */
+ DiskReadBuffer = (PVOID)(PcMemoryMap[i].BasePage * PAGE_SIZE);
+ DiskReadBufferSize = min(PcMemoryMap[i].PageCount * PAGE_SIZE,
+ MAX_DISKREADBUFFER_SIZE);
+ break;
+ }
+ }
+
+ TRACE("DiskReadBuffer=%p, DiskReadBufferSize=%lx\n",
+ DiskReadBuffer, DiskReadBufferSize);
+
+ /* Now reserve the range for the disk read buffer */
+ ReserveMemory((ULONG_PTR)DiskReadBuffer,
+ DiskReadBufferSize,
+ LoaderFirmwareTemporary,
+ "Disk read buffer");
TRACE("Dumping resulting memory map:\n");
- for (i = 0; i < EntryCount; i++)
+ for (i = 0; i < PcMapCount; i++)
{
TRACE("BasePage=0x%lx, PageCount=0x%lx, Type=%s\n",
PcMemoryMap[i].BasePage,
@@ -421,9 +508,9 @@
MmGetSystemMemoryMapTypeString(PcMemoryMap[i].MemoryType));
}
- *MemoryMapSize = EntryCount;
-
+ *MemoryMapSize = PcMapCount;
return PcMemoryMap;
}
+
/* EOF */
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -198,17 +198,17 @@
while (N > 0)
{
Length = N;
- if (Length > PcDiskReadBufferSize)
- Length = PcDiskReadBufferSize;
+ if (Length > DiskReadBufferSize)
+ Length = DiskReadBufferSize;
Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
ret = MachDiskReadLogicalSectors(
Context->DriveNumber,
Context->SectorNumber + Context->SectorOffset + i,
Sectors,
- (PVOID)DISKREADBUFFER);
+ DiskReadBuffer);
if (!ret)
return EIO;
- RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, Length);
+ RtlCopyMemory(Ptr, DiskReadBuffer, Length);
Ptr += Length;
*Count += Length;
N -= Length;
@@ -257,14 +257,14 @@
PARTITION_TABLE_ENTRY PartitionTableEntry;
/* Read the MBR */
- if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
+ if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, DiskReadBuffer))
{
ERR("Reading MBR failed\n");
return;
}
- Buffer = (ULONG*)DISKREADBUFFER;
- Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
+ Buffer = (ULONG*)DiskReadBuffer;
+ Mbr = (PMASTER_BOOT_RECORD)DiskReadBuffer;
Signature = Mbr->Signature;
TRACE("Signature: %x\n", Signature);
@@ -351,13 +351,13 @@
* harddisks. So, we set the buffer to known contents first, then try to
* read. If the BIOS reports success but the buffer contents haven't
* changed then we fail anyway */
- memset((PVOID) DISKREADBUFFER, 0xcd, PcDiskReadBufferSize);
- while (MachDiskReadLogicalSectors(0x80 + DiskCount, 0ULL, 1, (PVOID)DISKREADBUFFER))
+ memset(DiskReadBuffer, 0xcd, DiskReadBufferSize);
+ while (MachDiskReadLogicalSectors(0x80 + DiskCount, 0ULL, 1, DiskReadBuffer))
{
Changed = FALSE;
- for (i = 0; ! Changed && i < PcDiskReadBufferSize; i++)
+ for (i = 0; ! Changed && i < DiskReadBufferSize; i++)
{
- Changed = ((PUCHAR)DISKREADBUFFER)[i] != 0xcd;
+ Changed = ((PUCHAR)DiskReadBuffer)[i] != 0xcd;
}
if (! Changed)
{
@@ -366,7 +366,7 @@
break;
}
DiskCount++;
- memset((PVOID) DISKREADBUFFER, 0xcd, PcDiskReadBufferSize);
+ memset(DiskReadBuffer, 0xcd, DiskReadBufferSize);
}
DiskReportError(TRUE);
TRACE("BIOS reports %d harddisk%s\n",
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/cache/blocklist.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/cache/blocklist.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/cache/blocklist.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -119,13 +119,13 @@
}
// Now try to read in the block
- if (!MachDiskReadLogicalSectors(CacheDrive->DriveNumber, (BlockNumber *
CacheDrive->BlockSize), CacheDrive->BlockSize, (PVOID)DISKREADBUFFER))
+ if (!MachDiskReadLogicalSectors(CacheDrive->DriveNumber, (BlockNumber *
CacheDrive->BlockSize), CacheDrive->BlockSize, DiskReadBuffer))
{
FrLdrTempFree(CacheBlock->BlockData, TAG_CACHE_DATA);
FrLdrTempFree(CacheBlock, TAG_CACHE_BLOCK);
return NULL;
}
- RtlCopyMemory(CacheBlock->BlockData, (PVOID)DISKREADBUFFER,
CacheDrive->BlockSize * CacheDrive->BytesPerSector);
+ RtlCopyMemory(CacheBlock->BlockData, DiskReadBuffer, CacheDrive->BlockSize *
CacheDrive->BytesPerSector);
// Add it to our list of blocks managed by the cache
InsertTailList(&CacheDrive->CacheBlockHead, &CacheBlock->ListEntry);
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/disk/partition.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/disk/partition.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/disk/partition.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -202,11 +202,11 @@
ULONG Index;
// Read master boot record
- if (!MachDiskReadLogicalSectors(DriveNumber, LogicalSectorNumber, 1,
(PVOID)DISKREADBUFFER))
- {
- return FALSE;
- }
- RtlCopyMemory(BootRecord, (PVOID)DISKREADBUFFER, sizeof(MASTER_BOOT_RECORD));
+ if (!MachDiskReadLogicalSectors(DriveNumber, LogicalSectorNumber, 1,
DiskReadBuffer))
+ {
+ return FALSE;
+ }
+ RtlCopyMemory(BootRecord, DiskReadBuffer, sizeof(MASTER_BOOT_RECORD));
TRACE("Dumping partition table for drive 0x%x:\n", DriveNumber);
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/fs/ext2.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/fs/ext2.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -569,8 +569,8 @@
//{
// return FALSE;
//}
- //ReturnValue = MachDiskReadLogicalSectors(DriveNumber, SectorNumber +
Ext2VolumeStartSector, SectorCount, (PVOID)DISKREADBUFFER);
- //RtlCopyMemory(Buffer, (PVOID)DISKREADBUFFER, SectorCount *
DiskGeometry.BytesPerSector);
+ //ReturnValue = MachDiskReadLogicalSectors(DriveNumber, SectorNumber +
Ext2VolumeStartSector, SectorCount, DiskReadBuffer);
+ //RtlCopyMemory(Buffer, DiskReadBuffer, SectorCount * DiskGeometry.BytesPerSector);
//return ReturnValue;
return CacheReadDiskSectors(DriveNumber, SectorNumber + Ext2VolumeStartSector,
SectorCount, Buffer);
@@ -607,11 +607,11 @@
// Now try to read the super block
// If this fails then abort
- if (!MachDiskReadLogicalSectors(Ext2DriveNumber, Ext2VolumeStartSector, 8,
(PVOID)DISKREADBUFFER))
- {
- return FALSE;
- }
- RtlCopyMemory(Ext2SuperBlock, (PVOID)((ULONG_PTR)DISKREADBUFFER + 1024), 1024);
+ if (!MachDiskReadLogicalSectors(Ext2DriveNumber, Ext2VolumeStartSector, 8,
DiskReadBuffer))
+ {
+ return FALSE;
+ }
+ RtlCopyMemory(Ext2SuperBlock, ((PUCHAR)DiskReadBuffer + 1024), 1024);
TRACE("Dumping super block:\n");
TRACE("total_inodes: %d\n", Ext2SuperBlock->total_inodes);
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/arm/hardware.h [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -35,4 +35,4 @@
extern ULONG SecondLevelIcacheFillSize;
extern ULONG gDiskReadBuffer, gFileSysBuffer;
-#define DISKREADBUFFER gDiskReadBuffer
+#define DiskReadBuffer gDiskReadBuffer
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -63,6 +63,5 @@
extern BIOS_MEMORY_MAP PcBiosMemoryMap[];
extern ULONG PcBiosMapCount;
-extern ULONG PcDiskReadBufferSize;
/* EOF */
Modified:
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -4,11 +4,11 @@
#endif
/* Memory layout */
-//#ifdef _M_AMD64
+#ifdef _M_AMD64
#define PML4_ADDRESS HEX(1000) /* One page PML4 page table */
#define PDP_ADDRESS HEX(2000) /* One page PDP page table */
#define PD_ADDRESS HEX(3000) /* One page PD page table */
-//#endif
+#endif
#define BIOSCALLBUFFER HEX(4000) /* Buffer to store temporary data for any Int386()
call */
#define STACK16ADDR HEX(6F00) /* The 16-bit stack top will be at 0000:6F00 */
#define BSS_START HEX(6F00)
@@ -16,15 +16,13 @@
#define STACKADDR HEX(F000) /* The 32/64-bit stack top will be at 0000:F000, or
0xF000 */
#define FREELDR_BASE HEX(F800)
#define FREELDR_PE_BASE HEX(10000)
-#define DISKREADBUFFER HEX(8E000) /* Buffer to store data read in from the disk via
the BIOS */
-/* 9F000- 9FFFF is reserved for the EBDA */
+#define MEMORY_MARGIN HEX(88000) /* We need this much memory */
#define BIOSCALLBUFSEGMENT (BIOSCALLBUFFER/16) /* Buffer to store temporary data for any
Int386() call */
#define BIOSCALLBUFOFFSET HEX(0000) /* Buffer to store temporary data for any Int386()
call */
#define BIOSCALLBUFSIZE PAGE_SIZE /* max is sizeof(VESA_SVGA_INFO) = 512 */
-#define MAX_FREELDR_PE_SIZE (DISKREADBUFFER - FREELDR_PE_BASE)
-#define MIN_DISKREADBUFFER_SIZE HEX(1000)
-#define MAX_DISKREADBUFFER_SIZE HEX(C000)
+#define MAX_FREELDR_PE_SIZE (MEMORY_MARGIN - FREELDR_PE_BASE - PAGE_SIZE)
+#define MAX_DISKREADBUFFER_SIZE HEX(10000)
/* These addresses specify the realmode "BSS section" layout */
#define BSS_RealModeEntry (BSS_START + 0)
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/disk.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/disk.h [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -125,6 +125,8 @@
VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c
extern UCHAR FrldrBootDrive;
extern ULONG FrldrBootPartition;
+extern PVOID DiskReadBuffer;
+extern SIZE_T DiskReadBufferSize;
BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size);
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/mm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/include/mm.h [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -123,6 +123,7 @@
extern PVOID FrLdrDefaultHeap;
extern PVOID FrLdrTempHeap;
+extern SIZE_T FrLdrImageSize;
PVOID
FrLdrHeapCreate(
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/mm/meminit.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
---
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1]
(original)
+++
branches/ReactOS-0.3.17-FOSDEM2015/reactos/boot/freeldr/freeldr/mm/meminit.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -23,6 +23,17 @@
DBG_DEFAULT_CHANNEL(MEMORY);
+PVOID PageLookupTableAddress = NULL;
+PFN_NUMBER TotalPagesInLookupTable = 0;
+PFN_NUMBER FreePagesInLookupTable = 0;
+PFN_NUMBER LastFreePageHint = 0;
+PFN_NUMBER MmLowestPhysicalPage = 0xFFFFFFFF;
+PFN_NUMBER MmHighestPhysicalPage = 0;
+
+PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
+ULONG BiosMemoryMapEntryCount;
+SIZE_T FrLdrImageSize;
+
#if DBG
typedef struct
{
@@ -50,17 +61,42 @@
{ LoaderReserve, "Reserve" },
};
ULONG MemoryTypeCount = sizeof(MemoryTypeArray) / sizeof(MemoryTypeArray[0]);
+
+PCSTR
+MmGetSystemMemoryMapTypeString(
+ TYPE_OF_MEMORY Type)
+{
+ ULONG Index;
+
+ for (Index = 1; Index < MemoryTypeCount; Index++)
+ {
+ if (MemoryTypeArray[Index].Type == Type)
+ {
+ return MemoryTypeArray[Index].TypeString;
+ }
+ }
+
+ return MemoryTypeArray[0].TypeString;
+}
+
+VOID
+DbgDumpMemoryMap(
+ PFREELDR_MEMORY_DESCRIPTOR List)
+{
+ ULONG i;
+
+ DbgPrint("Dumping Memory map:\n");
+ for (i = 0; List[i].PageCount != 0; i++)
+ {
+ DbgPrint("%02d %08x - %08x: %s\n",
+ i,
+ List[i].BasePage * PAGE_SIZE,
+ (List[i].BasePage + List[i].PageCount) * PAGE_SIZE,
+ MmGetSystemMemoryMapTypeString(List[i].MemoryType));
+ }
+ DbgPrint("\n");
+}
#endif
-
-PVOID PageLookupTableAddress = NULL;
-PFN_NUMBER TotalPagesInLookupTable = 0;
-PFN_NUMBER FreePagesInLookupTable = 0;
-PFN_NUMBER LastFreePageHint = 0;
-PFN_NUMBER MmLowestPhysicalPage = 0xFFFFFFFF;
-PFN_NUMBER MmHighestPhysicalPage = 0;
-
-PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap;
-ULONG BiosMemoryMapEntryCount;
ULONG
AddMemoryDescriptor(
@@ -70,78 +106,117 @@
IN PFN_NUMBER PageCount,
IN TYPE_OF_MEMORY MemoryType)
{
- ULONG i, c;
- PFN_NUMBER NextBase;
- TRACE("AddMemoryDescriptor(0x%lx-0x%lx [0x%lx pages])\n",
- BasePage, BasePage + PageCount, PageCount);
-
- /* Scan through all existing descriptors */
- for (i = 0, c = 0; (c < MaxCount) && (List[c].PageCount != 0); c++)
- {
- /* Count entries completely below the new range */
- if (List[i].BasePage + List[i].PageCount <= BasePage) i++;
- }
-
- /* Check if the list is full */
- if (c >= MaxCount) return c;
-
- /* Is there an existing descriptor starting before the new range */
- while ((i < c) && (List[i].BasePage <= BasePage))
- {
- /* The end of the existing one is the minimum for the new range */
- NextBase = List[i].BasePage + List[i].PageCount;
-
- /* Bail out, if everything is trimmed away */
- if ((BasePage + PageCount) <= NextBase) return c;
-
- /* Trim the naew range at the lower end */
- PageCount -= (NextBase - BasePage);
- BasePage = NextBase;
-
- /* Go to the next entry and repeat */
- i++;
- }
-
- ASSERT(PageCount > 0);
-
- /* Are there still entries above? */
- if (i < c)
- {
- /* Shift the following entries one up */
- RtlMoveMemory(&List[i+1], &List[i], (c - i) * sizeof(List[0]));
-
- /* Insert the new range */
- List[i].BasePage = BasePage;
- List[i].PageCount = min(PageCount, List[i+1].BasePage - BasePage);
- List[i].MemoryType = MemoryType;
- c++;
-
- TRACE("Inserting at i=%ld: (0x%lx:0x%lx)\n",
- i, List[i].BasePage, List[i].PageCount);
-
- /* Check if the range was trimmed */
- if (PageCount > List[i].PageCount)
- {
- /* Recursively process the trimmed part */
- c = AddMemoryDescriptor(List,
- MaxCount,
- BasePage + List[i].PageCount,
- PageCount - List[i].PageCount,
- MemoryType);
- }
- }
- else
- {
- /* We can simply add the range here */
- TRACE("Adding i=%ld: (0x%lx:0x%lx)\n", i, BasePage, PageCount);
- List[i].BasePage = BasePage;
- List[i].PageCount = PageCount;
- List[i].MemoryType = MemoryType;
- c++;
- }
-
- /* Return the new count */
- return c;
+ ULONG Index, DescriptCount;
+ PFN_NUMBER EndPage;
+ TRACE("AddMemoryDescriptor(0x%Ix, 0x%Ix, %u)\n",
+ BasePage, PageCount, MemoryType);
+
+ EndPage = BasePage + PageCount;
+
+ /* Skip over all descriptor below the new range */
+ Index = 0;
+ while ((List[Index].PageCount != 0) &&
+ ((List[Index].BasePage + List[Index].PageCount) <= BasePage))
+ {
+ Index++;
+ }
+
+ /* Count the descriptors */
+ DescriptCount = Index;
+ while (List[DescriptCount].PageCount != 0)
+ {
+ DescriptCount++;
+ }
+
+ /* Check if the existing range conflicts with the new range */
+ while ((List[Index].PageCount != 0) &&
+ (List[Index].BasePage < EndPage))
+ {
+ TRACE("AddMemoryDescriptor conflict @%lu: new=[%lx:%lx],
existing=[%lx,%lx]\n",
+ Index, BasePage, PageCount, List[Index].BasePage, List[Index].PageCount);
+
+ /*
+ * We have 4 overlapping cases:
+ *
+ * Case (a) (b) (c) (d)
+ * Existing range |---| |-----| |---| |---|
+ * New range |---| |---| |-----| |---|
+ *
+ */
+
+ /* Check if the existing range starts before the new range (a)/(b) */
+ if (List[Index].BasePage < BasePage)
+ {
+ /* Check if the existing range extends beyond the new range (b) */
+ if (List[Index].BasePage + List[Index].PageCount > EndPage)
+ {
+ /* Split the descriptor */
+ RtlMoveMemory(&List[Index + 1],
+ &List[Index],
+ (DescriptCount - Index) * sizeof(List[0]));
+ List[Index + 1].BasePage = EndPage;
+ List[Index + 1].PageCount = List[Index].BasePage +
+ List[Index].PageCount -
+ List[Index + 1].BasePage;
+ List[Index].PageCount = BasePage - List[Index].BasePage;
+ Index++;
+ DescriptCount++;
+ break;
+ }
+ else
+ {
+ /* Crop the existing range and continue with the next range */
+ List[Index].PageCount = BasePage - List[Index].BasePage;
+ Index++;
+ }
+ }
+ /* Check if the existing range is fully covered by the new range (c) */
+ else if ((List[Index].BasePage + List[Index].PageCount) <=
+ EndPage)
+ {
+ /* Delete this descriptor */
+ RtlMoveMemory(&List[Index],
+ &List[Index + 1],
+ (DescriptCount - Index) * sizeof(List[0]));
+ DescriptCount--;
+ }
+ /* Otherwise the existing range ends after the new range (d) */
+ else
+ {
+ /* Crop the existing range at the start and bail out */
+ List[Index].PageCount -= EndPage - List[Index].BasePage;
+ List[Index].BasePage = EndPage;
+ break;
+ }
+ }
+
+ /* Make sure we can still add a new descriptor */
+ if (DescriptCount >= MaxCount)
+ {
+ FrLdrBugCheckWithMessage(
+ MEMORY_INIT_FAILURE,
+ __FILE__,
+ __LINE__,
+ "Ran out of static memory descriptors!");
+ }
+
+ /* Insert the new descriptor */
+ if (Index < DescriptCount)
+ {
+ RtlMoveMemory(&List[Index + 1],
+ &List[Index],
+ (DescriptCount - Index) * sizeof(List[0]));
+ }
+
+ List[Index].BasePage = BasePage;
+ List[Index].PageCount = PageCount;
+ List[Index].MemoryType = MemoryType;
+ DescriptCount++;
+
+#ifdef DBG
+ DbgDumpMemoryMap(List);
+#endif
+ return DescriptCount;
}
const FREELDR_MEMORY_DESCRIPTOR*
@@ -230,6 +305,9 @@
OptionalHeader->SizeOfImage, MAX_FREELDR_PE_SIZE,
OptionalHeader->SectionAlignment, OptionalHeader->FileAlignment);
}
+
+ /* Calculate the full image size */
+ FrLdrImageSize = (ULONG_PTR)&__ImageBase + OptionalHeader->SizeOfImage -
FREELDR_BASE;
}
BOOLEAN MmInitializeMemoryManager(VOID)
@@ -287,22 +365,6 @@
return TRUE;
}
-#if DBG
-PCSTR MmGetSystemMemoryMapTypeString(TYPE_OF_MEMORY Type)
-{
- ULONG Index;
-
- for (Index=1; Index<MemoryTypeCount; Index++)
- {
- if (MemoryTypeArray[Index].Type == Type)
- {
- return MemoryTypeArray[Index].TypeString;
- }
- }
-
- return MemoryTypeArray[0].TypeString;
-}
-#endif
PFN_NUMBER MmGetPageNumberFromAddress(PVOID Address)
{
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/cmake/CMakeMacros.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/cmake/CMakeMacros.cmake [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Mon
Jan 26 21:41:11 2015
@@ -265,7 +265,7 @@
endmacro()
function(add_cd_file)
- cmake_parse_arguments(_CD "NO_CAB"
"DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN})
+ cmake_parse_arguments(_CD "NO_CAB;NOT_IN_HYBRIDCD"
"DESTINATION;NAME_ON_CD;TARGET" "FILE;FOR" ${ARGN})
if(NOT (_CD_TARGET OR _CD_FILE))
message(FATAL_ERROR "You must provide a target or a file to install!")
endif()
@@ -306,8 +306,10 @@
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY BOOTCD_FILE_LIST
"${_CD_DESTINATION}/${__file}=${item}")
- #add it also into the hybridcd
- set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST
"bootcd/${_CD_DESTINATION}/${__file}=${item}")
+ #add it also into the hybridcd if not specified otherwise
+ if(NOT _CD_NOT_IN_HYBRIDCD)
+ set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST
"bootcd/${_CD_DESTINATION}/${__file}=${item}")
+ endif()
endforeach()
if(_CD_TARGET)
#manage dependency
@@ -343,8 +345,10 @@
get_filename_component(__file ${item} NAME)
endif()
set_property(GLOBAL APPEND PROPERTY LIVECD_FILE_LIST
"${_CD_DESTINATION}/${__file}=${item}")
- #add it also into the hybridcd
- set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST
"livecd/${_CD_DESTINATION}/${__file}=${item}")
+ #add it also into the hybridcd if not specified otherwise
+ if(NOT _CD_NOT_IN_HYBRIDCD)
+ set_property(GLOBAL APPEND PROPERTY HYBRIDCD_FILE_LIST
"livecd/${_CD_DESTINATION}/${__file}=${item}")
+ endif()
endforeach()
endif() #end livecd
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -1,2 +1,2 @@
-add_executable(cdmake cdmake.c dirhash.c llmosrt.c)
+add_executable(cdmake cdmake.c dirhash.c llmsort.c)
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/cdmake.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/cdmake.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/cdmake.c [iso-8859-1] Mon Jan
26 21:41:11 2015
@@ -653,7 +653,7 @@
{
PDIR_RECORD d;
- d = calloc(1, sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(*d));
if (d == NULL)
error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory;
@@ -687,7 +687,7 @@
char *n;
*/
- d = calloc(1, sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(*d));
if (d == NULL)
error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory;
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.c [iso-8859-1] Mon Jan
26 21:41:11 2015
@@ -39,7 +39,6 @@
last_slash = strrchr(name, '\\');
if (!last_slash)
{
- free(*dirname);
*dirname = malloc(1);
**dirname = 0;
}
@@ -48,7 +47,6 @@
char *newdata = malloc(last_slash - name + 1);
memcpy(newdata, name, last_slash - name);
newdata[last_slash - name] = 0;
- free(*dirname);
*dirname = newdata;
}
}
@@ -140,12 +138,14 @@
hashcode = djb_hash(targetnorm);
de = calloc(1, sizeof(*de));
de->parent = parent_de;
+ de->head = NULL;
+ de->child = NULL;
de->normalized_name = strdup(targetnorm);
de->case_name = strdup(chop_filename(casename));
de->next = parent_de->child;
parent_de->child = de;
ent = &dh->buckets[hashcode % NUM_DIR_HASH_BUCKETS];
- while ((*ent))
+ while (*ent)
{
ent = &(*ent)->next;
}
@@ -157,7 +157,6 @@
{
struct target_file *tf;
struct target_dir_entry *de;
- const char *filename = chop_filename(target);
char *targetdir = NULL;
char *targetnorm;
chop_dirname(target, &targetdir);
@@ -170,9 +169,10 @@
tf->next = de->head;
de->head = tf;
tf->source_name = strdup(source);
- tf->target_name = strdup(filename);
-}
-
+ tf->target_name = strdup(chop_filename(target));
+}
+
+#if 0
static struct target_dir_entry *
dir_hash_next_dir(struct target_dir_hash *dh, struct target_dir_traversal *t)
{
@@ -203,13 +203,13 @@
return t->it;
}
}
+#endif
static void
dir_hash_destroy_dir(struct target_dir_hash *dh, struct target_dir_entry *de)
{
struct target_file *tf;
struct target_dir_entry *te;
- unsigned int hashcode;
while ((te = de->child))
{
de->child = te->next;
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.h [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/dirhash.h [iso-8859-1] Mon Jan
26 21:41:11 2015
@@ -26,11 +26,13 @@
struct target_dir_entry root;
};
+#if 0
struct target_dir_traversal
{
struct target_dir_entry *it;
int i;
};
+#endif
void normalize_dirname(char *filename);
void dir_hash_add_file(struct target_dir_hash *dh, const char *source, const char
*target);
Removed: branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/llmosrt.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/llmosrt.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/tools/cdmake/llmosrt.c (removed)
@@ -1,105 +0,0 @@
-/* A Linked-List Memory Sort
- by Philip J. Erdelsky
- pje(a)acm.org
-
http://www.alumni.caltech.edu/~pje/
-*/
-
-/* According to his website, this file was released into the public domain by Phillip J.
Erdelsky */
-
-
-#include <stdio.h>
-
-void *sort_linked_list(void *p, unsigned index, int (*compare)(void *, void *))
-{
- unsigned base;
- unsigned long block_size;
-
- struct record
- {
- struct record *next[1];
- /* other members not directly accessed by this function */
- };
-
- struct tape
- {
- struct record *first, *last;
- unsigned long count;
- } tape[4];
-
- /* Distribute the records alternately to tape[0] and tape[1]. */
-
- tape[0].count = tape[1].count = 0L;
- tape[0].first = NULL;
- base = 0;
- while (p != NULL)
- {
- struct record *next = ((struct record *)p)->next[index];
- ((struct record *)p)->next[index] = tape[base].first;
- tape[base].first = ((struct record *)p);
- tape[base].count++;
- p = next;
- base ^= 1;
- }
-
- /* If the list is empty or contains only a single record, then */
- /* tape[1].count == 0L and this part is vacuous. */
-
- for (base = 0, block_size = 1L; tape[base+1].count != 0L;
- base ^= 2, block_size <<= 1)
- {
- int dest;
- struct tape *tape0, *tape1;
- tape0 = tape + base;
- tape1 = tape + base + 1;
- dest = base ^ 2;
- tape[dest].count = tape[dest+1].count = 0;
- for (; tape0->count != 0; dest ^= 1)
- {
- unsigned long n0, n1;
- struct tape *output_tape = tape + dest;
- n0 = n1 = block_size;
- while (1)
- {
- struct record *chosen_record;
- struct tape *chosen_tape;
- if (n0 == 0 || tape0->count == 0)
- {
- if (n1 == 0 || tape1->count == 0)
- break;
- chosen_tape = tape1;
- n1--;
- }
- else if (n1 == 0 || tape1->count == 0)
- {
- chosen_tape = tape0;
- n0--;
- }
- else if ((*compare)(tape0->first, tape1->first) > 0)
- {
- chosen_tape = tape1;
- n1--;
- }
- else
- {
- chosen_tape = tape0;
- n0--;
- }
- chosen_tape->count--;
- chosen_record = chosen_tape->first;
- chosen_tape->first = chosen_record->next[index];
- if (output_tape->count == 0)
- output_tape->first = chosen_record;
- else
- output_tape->last->next[index] = chosen_record;
- output_tape->last = chosen_record;
- output_tape->count++;
- }
- }
- }
-
- if (tape[base].count > 1L)
- tape[base].last->next[index] = NULL;
- return tape[base].first;
-}
-
-/* EOF */
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/pch.h
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/pch.h [iso-8859-1] (original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/pch.h [iso-8859-1] Mon Jan 26
21:41:11 2015
@@ -33,6 +33,7 @@
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
#define MAKEINTATOM(i) (LPWSTR)((ULONG_PTR)((WORD)(i)))
#define WINBASEAPI
+#define STARTF_USESHOWWINDOW 1
#define STARTF_USESIZE 2
#define STARTF_USEPOSITION 4
#include <stdarg.h>
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/main.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/main.c [iso-8859-1] Mon
Jan 26 21:41:11 2015
@@ -461,11 +461,14 @@
NTSTATUS Status = STATUS_SUCCESS;
PTEB pTeb;
LARGE_INTEGER LargeTickCount;
+ PRTL_USER_PROCESS_PARAMETERS ProcessParams;
Process = Thread->ThreadsProcess;
pTeb = NtCurrentTeb();
ASSERT(pTeb);
+
+ ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
/* Allocate a new Win32 thread info */
Status = AllocW32Thread(Thread, &ptiCurrent);
@@ -557,6 +560,24 @@
pci->CodePage = ptiCurrent->KeyboardLayout->CodePage;
}
+ /* Need to pass the user Startup Information to the current process. */
+ if ( ProcessParams )
+ {
+ if ( ptiCurrent->ppi->usi.cb == 0 ) // Not initialized yet.
+ {
+ if ( ProcessParams->WindowFlags != 0 ) // Need window flags set.
+ {
+ ptiCurrent->ppi->usi.cb = sizeof(USERSTARTUPINFO);
+ ptiCurrent->ppi->usi.dwX = ProcessParams->StartingX;
+ ptiCurrent->ppi->usi.dwY = ProcessParams->StartingY;
+ ptiCurrent->ppi->usi.dwXSize = ProcessParams->CountX;
+ ptiCurrent->ppi->usi.dwYSize = ProcessParams->CountY;
+ ptiCurrent->ppi->usi.dwFlags = ProcessParams->WindowFlags;
+ ptiCurrent->ppi->usi.wShowWindow =
(WORD)ProcessParams->ShowWindowFlags;
+ }
+ }
+ }
+
/* Assign a default window station and desktop to the process */
/* Do not try to open a desktop or window station before winlogon initializes */
if (ptiCurrent->ppi->hdeskStartup == NULL && gpidLogon != 0)
@@ -565,13 +586,11 @@
HDESK hDesk = NULL;
UNICODE_STRING DesktopPath;
PDESKTOP pdesk;
- PRTL_USER_PROCESS_PARAMETERS ProcessParams;
/*
* inherit the thread desktop and process window station (if not yet inherited)
from the process startup
* info structure. See documentation of CreateProcess()
*/
- ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
Status = STATUS_UNSUCCESSFUL;
if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -61,7 +61,9 @@
continue;
}
- if ((pWnd->style & WS_VISIBLE) && IntPtInWindow(pWnd, x, y))
+ if ((pWnd->style & WS_VISIBLE) &&
+ (pWnd->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == 0 &&
+ IntPtInWindow(pWnd, x, y))
return pWnd;
}
@@ -1476,18 +1478,17 @@
MOUSEHOOKSTRUCT hook;
BOOL eatMsg = FALSE;
- PWND pwndMsg, pwndDesktop, pwndOrig;
+ PWND pwndMsg, pwndDesktop;
PUSER_MESSAGE_QUEUE MessageQueue;
PTHREADINFO pti;
PSYSTEM_CURSORINFO CurInfo;
PDESKTOP pDesk;
- DECLARE_RETURN(BOOL);
pti = PsGetCurrentThreadWin32Thread();
pwndDesktop = UserGetDesktopWindow();
MessageQueue = pti->MessageQueue;
CurInfo = IntGetSysCursorInfo();
- pwndOrig = pwndMsg = ValidateHwndNoErr(msg->hwnd);
+ pwndMsg = ValidateHwndNoErr(msg->hwnd);
clk_msg = MessageQueue->msgDblClk;
pDesk = pwndDesktop->head.rpdesk;
@@ -1496,7 +1497,6 @@
{
hittest = HTCLIENT;
pwndMsg = MessageQueue->spwndCapture;
- if (pwndMsg) UserReferenceObject(pwndMsg);
}
else
{
@@ -1504,18 +1504,6 @@
Start with null window. See wine win.c:test_mouse_input:WM_COMMAND tests.
*/
pwndMsg = co_WinPosWindowFromPoint( NULL, &msg->pt, &hittest, FALSE);
- //
- // CORE-6129, Override if a diabled window, it might have a visible popup.
- //
- if ( pwndOrig && pwndOrig->style & WS_DISABLED )
- {
- if ( hittest == (USHORT)HTERROR )
- {
- if (pwndMsg) UserReferenceObject(pwndMsg);
- pwndMsg = pwndOrig;
- UserReferenceObject(pwndMsg);
- }
- }
}
TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest);
@@ -1525,7 +1513,7 @@
{
/* Remove and ignore the message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ( MessageQueue == gpqCursor ) // Cursor must use the same Queue!
@@ -1600,7 +1588,7 @@
if (!((first == 0 && last == 0) || (message >= first || message <=
last)))
{
TRACE("Message out of range!!!\n");
- RETURN(FALSE);
+ return FALSE;
}
/* update static double click conditions */
@@ -1611,7 +1599,7 @@
if (!((first == 0 && last == 0) || (message >= first || message <=
last)))
{
TRACE("Message out of range!!!\n");
- RETURN(FALSE);
+ return FALSE;
}
// Update mouse move down keys.
@@ -1621,7 +1609,7 @@
}
}
- if(gspv.bMouseClickLock)
+ if (gspv.bMouseClickLock)
{
BOOL IsClkLck = FALSE;
@@ -1649,11 +1637,11 @@
/* Remove and ignore the message */
*RemoveMessages = TRUE;
TRACE("Remove and ignore the message\n");
- RETURN(FALSE);
+ return FALSE;
}
}
- /* message is accepted now (but may still get dropped) */
+ /* message is accepted now (but still get dropped) */
event.message = msg->message;
event.time = msg->time;
@@ -1679,23 +1667,23 @@
/* Remove and skip message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ((hittest == (USHORT)HTERROR) || (hittest == (USHORT)HTNOWHERE))
{
co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG(
hittest, msg->message ));
- ERR("HT errors!\n");
+
/* Remove and skip message */
*RemoveMessages = TRUE;
- RETURN(FALSE);
+ return FALSE;
}
if ((*RemoveMessages == FALSE) || MessageQueue->spwndCapture)
{
/* Accept the message */
msg->message = message;
- RETURN(TRUE);
+ return TRUE;
}
if ((msg->message == WM_LBUTTONDOWN) ||
@@ -1753,13 +1741,7 @@
co_IntSendMessage( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, MAKELONG(
hittest, msg->message ));
msg->message = message;
- RETURN(!eatMsg);
-
-CLEANUP:
- if(pwndMsg)
- UserDereferenceObject(pwndMsg);
-
- END_CLEANUP;
+ return !eatMsg;
}
BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages)
Modified: branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/winpos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ReactOS-0.3.17-FOSDEM2015/react…
==============================================================================
--- branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1]
(original)
+++ branches/ReactOS-0.3.17-FOSDEM2015/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1]
Mon Jan 26 21:41:11 2015
@@ -2168,12 +2168,49 @@
PTHREADINFO pti;
//HRGN VisibleRgn;
BOOL ShowOwned = FALSE;
+ BOOL FirstTime = FALSE;
ASSERT_REFS_CO(Wnd);
//ERR("co_WinPosShowWindow START\n");
pti = PsGetCurrentThreadWin32Thread();
WasVisible = (Wnd->style & WS_VISIBLE) != 0;
style = Wnd->style;
+
+ TRACE("co_WinPosShowWindow START hwnd %p Cmd %d usicmd
%d\n",Wnd->head.h,Cmd,pti->ppi->usi.wShowWindow);
+
+ if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
+ {
+ if ((Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
+ {
+ if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
+ {
+ if (Wnd->spwndOwner == NULL)
+ {
+ if ( Cmd == SW_SHOWNORMAL || Cmd == SW_SHOW)
+ {
+ Cmd = SW_SHOWDEFAULT;
+ }
+ FirstTime = TRUE;
+ ERR("co_WPSW FT 1\n");
+ }
+ }
+ }
+ }
+
+ if ( Cmd == SW_SHOWDEFAULT )
+ {
+ if ( pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW )
+ {
+ Cmd = pti->ppi->usi.wShowWindow;
+ FirstTime = TRUE;
+ ERR("co_WPSW FT 2\n");
+ }
+ }
+
+ if (FirstTime)
+ {
+ pti->ppi->usi.dwFlags &=
~(STARTF_USEPOSITION|STARTF_USESIZE|STARTF_USESHOWWINDOW);
+ }
switch (Cmd)
{
@@ -2182,7 +2219,7 @@
if (!WasVisible)
{
//ERR("co_WinPosShowWindow Exit Bad\n");
- return(FALSE);
+ return FALSE;
}
Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if (Wnd != pti->MessageQueue->spwndActive)
@@ -2406,7 +2443,7 @@
if (!(style & WS_CHILD)) co_IntSendMessageNoWait(UserHMGetHandle(Wnd),
WM_ACTIVATE, WA_ACTIVE, 0);
}
//ERR("co_WinPosShowWindow EXIT\n");
- return(WasVisible);
+ return WasVisible;
}
static PWND
@@ -2417,31 +2454,43 @@
IN BOOL Ignore
)
{
- PWND pwndChild;
HWND *List, *phWnd;
-
+ PWND pwndChild = NULL;
+
+ /* not visible */
if (!(ScopeWin->style & WS_VISIBLE))
{
return NULL;
}
+ /* not in window or in window region */
+ if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
+ {
+ return NULL;
+ }
+
+ /* transparent */
+ if ((ScopeWin->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) ==
(WS_EX_LAYERED|WS_EX_TRANSPARENT))
+ {
+ return NULL;
+ }
+
if (!Ignore && (ScopeWin->style & WS_DISABLED))
- {
+ { /* disabled child */
+ if ((ScopeWin->style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return NULL;
+ /* process the hit error */
*HitTest = HTERROR;
- return NULL;
- }
-
- if (!IntPtInWindow(ScopeWin, Point->x, Point->y))
- {
- return NULL;
- }
-
- UserReferenceObject(ScopeWin);
-
- if ( RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
- {
+ return ScopeWin;
+ }
+
+ /* not minimized and check if point is inside the window */
+ if (!(ScopeWin->style & WS_MINIMIZE) &&
+ RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
+ {
+ UserReferenceObject(ScopeWin);
+
List = IntWinListChildren(ScopeWin);
- if(List)
+ if (List)
{
for (phWnd = List; *phWnd; ++phWnd)
{
@@ -2452,7 +2501,7 @@
pwndChild = co_WinPosSearchChildren(pwndChild, Point, HitTest, Ignore);
- if(pwndChild != NULL)
+ if (pwndChild != NULL)
{
/* We found a window. Don't send any more WM_NCHITTEST messages
*/
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
@@ -2462,6 +2511,7 @@
}
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
}
+ UserDereferenceObject(ScopeWin);
}
if (ScopeWin->head.pti == PsGetCurrentThreadWin32Thread())
@@ -2470,7 +2520,6 @@
if ((*HitTest) == (USHORT)HTTRANSPARENT)
{
- UserDereferenceObject(ScopeWin);
return NULL;
}
}
@@ -2483,7 +2532,11 @@
}
PWND APIENTRY
-co_WinPosWindowFromPoint(IN PWND ScopeWin, IN POINT *WinPoint, IN OUT USHORT* HitTest, IN
BOOL Ignore)
+co_WinPosWindowFromPoint(
+ IN PWND ScopeWin,
+ IN POINT *WinPoint,
+ IN OUT USHORT* HitTest,
+ IN BOOL Ignore)
{
PWND Window;
POINT Point = *WinPoint;
@@ -3433,7 +3486,6 @@
RETURN( NULL);
CLEANUP:
- if (Window) UserDereferenceObject(Window);
if (DesktopWindow) UserDerefObjectCo(DesktopWindow);
TRACE("Leave NtUserWindowFromPoint, ret=%p\n", _ret_);