|
From: Jeffrey D. <ha...@us...> - 2003-09-27 06:10:22
|
Log Message:
-----------
NoMovies hook
Modified Files:
--------------
/cvsroot/decaldev/source/Inject:
Inject.cpp
Revision Data
-------------
Index: Inject.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/Inject/Inject.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Inject.cpp 26 Sep 2003 22:07:28 -0000 1.29
+++ Inject.cpp 27 Sep 2003 05:29:10 -0000 1.30
@@ -47,8 +47,12 @@
// Functions for hooking from kernel32.dll
HANDLE WINAPI CreateFileF( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile );
+// Function for dual logging
HANDLE WINAPI Replacement_CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCTSTR lpName );
+// Function for no movies
+HFILE WINAPI Replacement_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle );
+
enum eAddressing
{
eByName,
@@ -76,10 +80,16 @@
static bool bDualLog = false;
static bool bWindowed = false;
static bool bNoSplash = false;
+static bool bNoMovies = false;
+
static cHookDescriptor _hooksDualLog[] = {
{ eByName, _T( "kernel32.dll" ), _T( "CreateSemaphoreA" ), 102, reinterpret_cast< DWORD >( Replacement_CreateSemaphoreA ), 0 },
};
+static cHookDescriptor _hooksNoMovies[] = {
+ { eByName, _T( "kernel32.dll" ), _T( "OpenFile" ), 630, reinterpret_cast< DWORD >( Replacement_OpenFile ), 0 },
+};
+
bool CheckClientVersion( MSXML::IXMLDOMDocument *pDoc );
bool PatchWindowMode( MSXML::IXMLDOMDocument *pDoc );
bool PatchNoSplash( MSXML::IXMLDOMDocument *pDoc );
@@ -110,10 +120,10 @@
hookFunctions( _hooks, 2 );
bRegisteredInAC = true;
- // Check if dual logging is enabled
RegKey key;
if( key.Open( HKEY_LOCAL_MACHINE, "SOFTWARE\\Decal" ) == ERROR_SUCCESS )
{
+ // Check if dual logging is enabled
DWORD dwReg = 0;
if( key.QueryDWORDValue( "AllowDualLog", dwReg ) == ERROR_SUCCESS )
{
@@ -123,6 +133,18 @@
hookFunctions( _hooksDualLog, 1 );
}
}
+
+ // Check if movies are disabled
+ dwReg = 0;
+ if( key.QueryDWORDValue( "NoMovies", dwReg ) == ERROR_SUCCESS )
+ {
+ if( dwReg )
+ {
+ bNoMovies = true;
+ hookFunctions( _hooksNoMovies, 1 );
+ }
+ }
+
}
key.Close();
@@ -364,6 +386,15 @@
else
return CreateSemaphore( lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName );
+}
+
+HFILE WINAPI Replacement_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle )
+{
+ if( strstr( lpFileName, "\\movies\\" ) != NULL )
+ return HFILE_ERROR;
+
+ else
+ return OpenFile( lpFileName, lpReOpenBuff, uStyle );
}
bool CheckClientVersion( MSXML::IXMLDOMDocument *pDoc )
|