[ros-bugs] [Bug 2936] New: Overwrite a loaded dll.

ReactOS.Bugzilla at www.reactos.org ReactOS.Bugzilla at www.reactos.org
Sat Jan 5 17:31:15 CET 2008


http://www.reactos.org/bugzilla/show_bug.cgi?id=2936

           Summary: Overwrite a loaded dll.
           Product: ReactOS
           Version: TRUNK
          Platform: QEmu
        OS/Version: ReactOS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Kernel
        AssignedTo: ros-bugs at reactos.org
        ReportedBy: netzimme at aim.com
         QAContact: ros-bugs at reactos.org


When open a dll i can overwrite the loaded dll.

Daniel Zimmermann

here some pseudo-code to reproduce the problem:

#define DbgTPrint _tprintf
#define DBG_CHECKPOINT _tprintf(_T("Checkpoint :%i\n"),__LINE__);

void testOverwriteLockedModule(void)
{
   HANDLE  fileHandle;
   BOOL bCopyTest;
   HMODULE hMod;

   // delete priv. copy
   DeleteFile(_T("msvcrt2.dll"));

   // copy new dll
   bCopyTest = CopyFile(_T("msvcrt.dll"),_T("msvcrt2.dll"),FALSE);
   if (bCopyTest==FALSE)
   {
      DbgTPrint(_T("copy msvcrt.dll failed"));
   }

   DBG_CHECKPOINT;

   // open module (i this it will open with FILE_SHARE_READ, but not
FILE_SHARE_WRITE)
   hMod = LoadLibrary(_T("msvcrt2.dll"));
   DbgTPrint(_T("hMod %p\n"),hMod);

   DBG_CHECKPOINT;

   // Open with write access
   fileHandle  = CreateFile(_T("msvcrt2.dll"), GENERIC_WRITE            ,
FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
   if (fileHandle!=INVALID_HANDLE_VALUE)
   {
      DbgTPrint(_T("This is wrong. File always open. Filehandle
%p\n"),fileHandle);
   }

   DBG_CHECKPOINT;

   FreeLibrary(hMod);
   CloseHandle(fileHandle);
   DBG_CHECKPOINT;
}


-- 
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the Ros-bugs mailing list