Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Kernel32.dll

Kernel32.dll

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hph
    wrote on last edited by
    #1

    Hey, i have my own kernel32.dll and i also have a test program which should use it! How do i tell the program that it should load my Kernel32.dll and not the Windows Kernel32.dll ? Has someone an idea ? Thanks in advance!

    P M C 3 Replies Last reply
    0
    • H hph

      Hey, i have my own kernel32.dll and i also have a test program which should use it! How do i tell the program that it should load my Kernel32.dll and not the Windows Kernel32.dll ? Has someone an idea ? Thanks in advance!

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      what!!! One of the reason for creating COM was to eliminate the accidental versioning problem, and you want to purposely create the version prob,you must be out of ur head. Peace The World is getting smaller and so are the people.

      H 1 Reply Last reply
      0
      • P Prakash Nadar

        what!!! One of the reason for creating COM was to eliminate the accidental versioning problem, and you want to purposely create the version prob,you must be out of ur head. Peace The World is getting smaller and so are the people.

        H Offline
        H Offline
        hph
        wrote on last edited by
        #3

        don't panic! if you know how, then please tell me! Thanks!

        P 1 Reply Last reply
        0
        • H hph

          don't panic! if you know how, then please tell me! Thanks!

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          ok, Which program are you talking about that wants to use ur kernel32.dll if its ur kernel32.dll then you should gives its full path from where you are trying to load the dll. If its other applications that you want to load ur dll then simple copy ur kernel32.dll into system32 folder in ur windows directory. Hope i answered ur question. cheers. The World is getting smaller and so are the people.

          1 Reply Last reply
          0
          • H hph

            Hey, i have my own kernel32.dll and i also have a test program which should use it! How do i tell the program that it should load my Kernel32.dll and not the Windows Kernel32.dll ? Has someone an idea ? Thanks in advance!

            M Offline
            M Offline
            Mike Dimmick
            wrote on last edited by
            #5

            Kernel32 is very, very tightly linked to the version of Windows that it's installed with. You'll notice how whenever Microsoft make a patch to NTOSKRNL.EXE or CSRSS.EXE on Windows 2000/XP/Server 2003, they also ship a new version of kernel32.dll. DO NOT DO THIS. Normally you can redirect a DLL by copying it into the same directory as your application, but this won't work for kernel32.dll because that's where Windows starts your process: in the BaseProcessStart function in kernel32.dll (see Inside Windows 2000 [Solomon & Russinovich, MS Press]). Once a DLL is loaded, Windows will use the one it's already got rather than loading a different version with the same name (IIRC). It might help if you explained the effect you're actually after - perhaps you're trying to inject some code into a different process? If you explain that, you might get more help.

            H 1 Reply Last reply
            0
            • H hph

              Hey, i have my own kernel32.dll and i also have a test program which should use it! How do i tell the program that it should load my Kernel32.dll and not the Windows Kernel32.dll ? Has someone an idea ? Thanks in advance!

              C Offline
              C Offline
              Ceri
              wrote on last edited by
              #6

              What are you trying to acheive? Like somebody has already stated, kernel32.dll has to be linked tightly to a compiled win32 executable. Stubbing kernel32.dll I would imagine would be almost impossible.

              1 Reply Last reply
              0
              • M Mike Dimmick

                Kernel32 is very, very tightly linked to the version of Windows that it's installed with. You'll notice how whenever Microsoft make a patch to NTOSKRNL.EXE or CSRSS.EXE on Windows 2000/XP/Server 2003, they also ship a new version of kernel32.dll. DO NOT DO THIS. Normally you can redirect a DLL by copying it into the same directory as your application, but this won't work for kernel32.dll because that's where Windows starts your process: in the BaseProcessStart function in kernel32.dll (see Inside Windows 2000 [Solomon & Russinovich, MS Press]). Once a DLL is loaded, Windows will use the one it's already got rather than loading a different version with the same name (IIRC). It might help if you explained the effect you're actually after - perhaps you're trying to inject some code into a different process? If you explain that, you might get more help.

                H Offline
                H Offline
                hph
                wrote on last edited by
                #7

                good! here's what i want to do: I have written a program which injects some code into a .exe or .dll file to make them depended on a additional dll! It works great with nearly every .exe and .dll file but my goal is to reach this result also with the kernel32.dll! So the problem is that i can't simply replace my kernel32.dll with the original one, because it's not allowed! Is there a way at all?

                D M 2 Replies Last reply
                0
                • H hph

                  good! here's what i want to do: I have written a program which injects some code into a .exe or .dll file to make them depended on a additional dll! It works great with nearly every .exe and .dll file but my goal is to reach this result also with the kernel32.dll! So the problem is that i can't simply replace my kernel32.dll with the original one, because it's not allowed! Is there a way at all?

                  D Offline
                  D Offline
                  Daniel Turini
                  wrote on last edited by
                  #8

                  hph wrote: good! here's what i want to do: I have written a program which injects some code into a .exe or .dll file to make them depended on a additional dll! It works great with nearly every .exe and .dll file but my goal is to reach this result also with the kernel32.dll! So the problem is that i can't simply replace my kernel32.dll with the original one, because it's not allowed! Exactly: Kernel32.dll is part of the OS. You can't use another one. You'd only be able to do this by bundling the whole OS with your app. That's it. Also, several other DLLs won't work too, although they may seem to work at first sight: all related to winsock, printing, GDI, sound subsystem, DirectX, etc. There is a place (sorry, I don't recall where right now) on MSDN that lists which DLLs you shouldn't mess with. What you want could theoretically be accomplished with Linux, but not with Windows. Trying to make bits uncopyable is like trying to make water not wet. -- Bruce Schneier By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn

                  1 Reply Last reply
                  0
                  • H hph

                    good! here's what i want to do: I have written a program which injects some code into a .exe or .dll file to make them depended on a additional dll! It works great with nearly every .exe and .dll file but my goal is to reach this result also with the kernel32.dll! So the problem is that i can't simply replace my kernel32.dll with the original one, because it's not allowed! Is there a way at all?

                    M Offline
                    M Offline
                    Mike Dimmick
                    wrote on last edited by
                    #9

                    OK, let's take another step back: why do you want to load this extra DLL into the process? What are you trying to achieve? You might find this useful: Three Ways to Inject Your Code into Another Process[^]. On NT-based versions of Windows, you can use the AppInit_DLLs registry value to load a DLL into every process. However, there are some severe limitations with this: see http://support.microsoft.com/?id=197571[^].

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups