mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 06:58:10 +00:00
[TCPSVCS] Remove hardcoded C drive letter (#800)
CORE-13228, CORE-13235 For USETUP, add a comment about why the code uses it when adding a boot-sector boot entry to NTLDR. CORE-13226
This commit is contained in:
parent
9d0596afe1
commit
b0a1cb52be
3 changed files with 12 additions and 3 deletions
|
@ -12,7 +12,7 @@
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
static LPWSTR lpEventSource = L"tcpsvcs";
|
static LPWSTR lpEventSource = L"tcpsvcs";
|
||||||
static LPCWSTR lpLogFileName = L"C:\\tcpsvcs_log.log";
|
static WCHAR szLogFileName[MAX_PATH];
|
||||||
static HANDLE hLogFile = NULL;
|
static HANDLE hLogFile = NULL;
|
||||||
|
|
||||||
static OVERLAPPED olWrite;
|
static OVERLAPPED olWrite;
|
||||||
|
@ -47,7 +47,7 @@ LogToEventLog(LPCWSTR lpMsg,
|
||||||
static BOOL
|
static BOOL
|
||||||
OpenLogFile()
|
OpenLogFile()
|
||||||
{
|
{
|
||||||
hLogFile = CreateFileW(lpLogFileName,
|
hLogFile = CreateFileW(szLogFileName,
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
FILE_SHARE_READ,
|
FILE_SHARE_READ,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -212,13 +212,19 @@ InitLogging()
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
BOOL bRet = FALSE;
|
BOOL bRet = FALSE;
|
||||||
|
|
||||||
|
if (!GetEnvironmentVariableW(L"SystemDrive", szLogFileName, ARRAYSIZE(szLogFileName)))
|
||||||
|
{
|
||||||
|
StringCchCopyW(szLogFileName, ARRAYSIZE(szLogFileName), L"C:");
|
||||||
|
}
|
||||||
|
StringCchCatW(szLogFileName, ARRAYSIZE(szLogFileName), L"\\tcpsvcs_log.log");
|
||||||
|
|
||||||
ZeroMemory(&olWrite, sizeof(OVERLAPPED));
|
ZeroMemory(&olWrite, sizeof(OVERLAPPED));
|
||||||
olWrite.Offset = 0xFFFFFFFF;
|
olWrite.Offset = 0xFFFFFFFF;
|
||||||
olWrite.OffsetHigh = 0xFFFFFFFF;
|
olWrite.OffsetHigh = 0xFFFFFFFF;
|
||||||
olWrite.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
olWrite.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
if (olWrite.hEvent)
|
if (olWrite.hEvent)
|
||||||
{
|
{
|
||||||
DeleteFileW(lpLogFileName);
|
DeleteFileW(szLogFileName);
|
||||||
|
|
||||||
if (OpenLogFile())
|
if (OpenLogFile())
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#define _INC_WINDOWS
|
#define _INC_WINDOWS
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
#define LOG_FILE 1
|
#define LOG_FILE 1
|
||||||
#define LOG_EVENTLOG 2
|
#define LOG_EVENTLOG 2
|
||||||
|
|
|
@ -2378,6 +2378,8 @@ InstallFatBootcodeToPartition(
|
||||||
/* Update 'boot.ini' */
|
/* Update 'boot.ini' */
|
||||||
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"boot.ini");
|
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"boot.ini");
|
||||||
|
|
||||||
|
/* Windows' NTLDR loads an external bootsector file when the specified drive
|
||||||
|
letter is C:, otherwise it will interpret it as a boot DOS path specifier. */
|
||||||
DPRINT1("Update 'boot.ini': %S\n", DstPath);
|
DPRINT1("Update 'boot.ini': %S\n", DstPath);
|
||||||
Status = UpdateBootIni(DstPath,
|
Status = UpdateBootIni(DstPath,
|
||||||
L"C:\\bootsect.ros",
|
L"C:\\bootsect.ros",
|
||||||
|
|
Loading…
Reference in a new issue