Commit e0ce6dc3 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move Get/SetProcessDword to kernel16.c.

parent 806deab0
......@@ -25,6 +25,7 @@
#include "winbase.h"
#include "winternl.h"
#include "wownt32.h"
#include "wine/winuser16.h"
#include "kernel_private.h"
#include "kernel16_private.h"
......@@ -32,6 +33,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(module);
extern DWORD WINAPI GetProcessFlags( DWORD processid );
static DWORD process_dword;
/**************************************************************************
* DllEntryPoint (KERNEL.669)
*/
......@@ -580,6 +585,116 @@ DWORD WINAPI MapProcessHandle( HANDLE hProcess )
}
/***********************************************************************
* SetProcessDword (KERNEL.484)
* 'Of course you cannot directly access Windows internal structures'
*/
void WINAPI SetProcessDword16( DWORD dwProcessID, INT offset, DWORD value )
{
TRACE("(%d, %d)\n", dwProcessID, offset );
if (dwProcessID && dwProcessID != GetCurrentProcessId())
{
ERR("%d: process %x not accessible\n", offset, dwProcessID);
return;
}
switch ( offset )
{
case GPD_APP_COMPAT_FLAGS:
case GPD_LOAD_DONE_EVENT:
case GPD_HINSTANCE16:
case GPD_WINDOWS_VERSION:
case GPD_THDB:
case GPD_PDB:
case GPD_STARTF_SHELLDATA:
case GPD_STARTF_HOTKEY:
case GPD_STARTF_SHOWWINDOW:
case GPD_STARTF_SIZE:
case GPD_STARTF_POSITION:
case GPD_STARTF_FLAGS:
case GPD_PARENT:
case GPD_FLAGS:
ERR("Not allowed to modify offset %d\n", offset );
break;
case GPD_USERDATA:
process_dword = value;
break;
default:
ERR("Unknown offset %d\n", offset );
break;
}
}
/***********************************************************************
* GetProcessDword (KERNEL.485)
* 'Of course you cannot directly access Windows internal structures'
*/
DWORD WINAPI GetProcessDword16( DWORD dwProcessID, INT offset )
{
DWORD x, y;
STARTUPINFOW siw;
TRACE("(%d, %d)\n", dwProcessID, offset );
if (dwProcessID && dwProcessID != GetCurrentProcessId())
{
ERR("%d: process %x not accessible\n", offset, dwProcessID);
return 0;
}
switch ( offset )
{
case GPD_APP_COMPAT_FLAGS:
return GetAppCompatFlags16(0);
case GPD_LOAD_DONE_EVENT:
return 0;
case GPD_HINSTANCE16:
return GetTaskDS16();
case GPD_WINDOWS_VERSION:
return GetExeVersion16();
case GPD_THDB:
return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
case GPD_PDB:
return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
GetStartupInfoW(&siw);
return HandleToULong(siw.hStdOutput);
case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
GetStartupInfoW(&siw);
return HandleToULong(siw.hStdInput);
case GPD_STARTF_SHOWWINDOW:
GetStartupInfoW(&siw);
return siw.wShowWindow;
case GPD_STARTF_SIZE:
GetStartupInfoW(&siw);
x = siw.dwXSize;
if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
y = siw.dwYSize;
if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
return MAKELONG( x, y );
case GPD_STARTF_POSITION:
GetStartupInfoW(&siw);
x = siw.dwX;
if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
y = siw.dwY;
if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
return MAKELONG( x, y );
case GPD_STARTF_FLAGS:
GetStartupInfoW(&siw);
return siw.dwFlags;
case GPD_PARENT:
return 0;
case GPD_FLAGS:
return GetProcessFlags(0);
case GPD_USERDATA:
return process_dword;
default:
ERR("Unknown offset %d\n", offset );
return 0;
}
}
/***********************************************************************
* FreeLibrary32 (KERNEL.486)
*/
BOOL WINAPI FreeLibrary32_16( HINSTANCE module )
......
......@@ -386,8 +386,8 @@
481 pascal -ret16 _LeaveWin16Lock() _LeaveWin16Lock
482 pascal LoadSystemLibrary32(str) LoadLibrary32_16 # FIXME!
483 pascal MapProcessHandle(long) MapProcessHandle
484 pascal SetProcessDword(long s_word long) SetProcessDword
485 pascal GetProcessDword(long s_word) GetProcessDword
484 pascal SetProcessDword(long s_word long) SetProcessDword16
485 pascal GetProcessDword(long s_word) GetProcessDword16
486 pascal FreeLibrary32(long) FreeLibrary32_16
487 pascal GetModuleFileName32(long str word) GetModuleFileName32_16
488 pascal GetModuleHandle32(str) GetModuleHandle32_16
......
......@@ -74,7 +74,6 @@ static UINT process_error_mode;
static DWORD shutdown_flags = 0;
static DWORD shutdown_priority = 0x280;
static DWORD process_dword;
static BOOL is_wow64;
HMODULE kernel32_handle = 0;
......@@ -2537,114 +2536,12 @@ DWORD WINAPI GetProcessFlags( DWORD processid )
/***********************************************************************
* GetProcessDword (KERNEL.485)
* GetProcessDword (KERNEL32.18)
* 'Of course you cannot directly access Windows internal structures'
*/
DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
{
DWORD x, y;
STARTUPINFOW siw;
TRACE("(%d, %d)\n", dwProcessID, offset );
if (dwProcessID && dwProcessID != GetCurrentProcessId())
{
ERR("%d: process %x not accessible\n", offset, dwProcessID);
return 0;
}
switch ( offset )
{
case GPD_APP_COMPAT_FLAGS:
return GetAppCompatFlags16(0);
case GPD_LOAD_DONE_EVENT:
return 0;
case GPD_HINSTANCE16:
return GetTaskDS16();
case GPD_WINDOWS_VERSION:
return GetExeVersion16();
case GPD_THDB:
return (DWORD_PTR)NtCurrentTeb() - 0x10 /* FIXME */;
case GPD_PDB:
return (DWORD_PTR)NtCurrentTeb()->Peb; /* FIXME: truncating a pointer */
case GPD_STARTF_SHELLDATA: /* return stdoutput handle from startupinfo ??? */
GetStartupInfoW(&siw);
return HandleToULong(siw.hStdOutput);
case GPD_STARTF_HOTKEY: /* return stdinput handle from startupinfo ??? */
GetStartupInfoW(&siw);
return HandleToULong(siw.hStdInput);
case GPD_STARTF_SHOWWINDOW:
GetStartupInfoW(&siw);
return siw.wShowWindow;
case GPD_STARTF_SIZE:
GetStartupInfoW(&siw);
x = siw.dwXSize;
if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
y = siw.dwYSize;
if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
return MAKELONG( x, y );
case GPD_STARTF_POSITION:
GetStartupInfoW(&siw);
x = siw.dwX;
if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
y = siw.dwY;
if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
return MAKELONG( x, y );
case GPD_STARTF_FLAGS:
GetStartupInfoW(&siw);
return siw.dwFlags;
case GPD_PARENT:
return 0;
case GPD_FLAGS:
return GetProcessFlags(0);
case GPD_USERDATA:
return process_dword;
default:
ERR("Unknown offset %d\n", offset );
return 0;
}
}
/***********************************************************************
* SetProcessDword (KERNEL.484)
* 'Of course you cannot directly access Windows internal structures'
*/
void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
{
TRACE("(%d, %d)\n", dwProcessID, offset );
if (dwProcessID && dwProcessID != GetCurrentProcessId())
{
ERR("%d: process %x not accessible\n", offset, dwProcessID);
return;
}
switch ( offset )
{
case GPD_APP_COMPAT_FLAGS:
case GPD_LOAD_DONE_EVENT:
case GPD_HINSTANCE16:
case GPD_WINDOWS_VERSION:
case GPD_THDB:
case GPD_PDB:
case GPD_STARTF_SHELLDATA:
case GPD_STARTF_HOTKEY:
case GPD_STARTF_SHOWWINDOW:
case GPD_STARTF_SIZE:
case GPD_STARTF_POSITION:
case GPD_STARTF_FLAGS:
case GPD_PARENT:
case GPD_FLAGS:
ERR("Not allowed to modify offset %d\n", offset );
break;
case GPD_USERDATA:
process_dword = value;
break;
default:
ERR("Unknown offset %d\n", offset );
break;
}
FIXME( "(%d, %d): not supported\n", dwProcessID, offset );
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment