.. caused an error in KERNEL32.DLL

This is a discussion on .. caused an error in KERNEL32.DLL within the C Programming forums, part of the General Programming Boards category; Hello, I wrote a program (actually a game) in Windows XP (pro) using Dev-C/C++ compiler ( www.bloodshed.net ). I run ...

  1. #1
    Unregistered
    Guest

    .. caused an error in KERNEL32.DLL

    Hello,

    I wrote a program (actually a game) in Windows XP (pro) using Dev-C/C++ compiler (www.bloodshed.net). I run the game on Windows XP and Windows 2000 systems just fine, but when I try to run it on Windows ME and '98, it crashes with an error:

    Game has caused an error in KERNEL32.DLL.
    Game will now close.

    If you continue to experience problems, try restarting your computer.

    [CLOSE]
    I'm not quite sure what is causing it to do it. I thought it was that when it's compiled, it uses different system info so it may crash on other OS's but I tried compiling it on WinME and it still gives the same error (if it even compiles, Dev-C compilers gives an error "couldn't run program" or something along those lines).

    Any idea?

    I'd post the whole program here but it's over 10 files and about 2,000 lines =)

    I didn't use anything out of the ordinary, just some write to console and screen buffer stuff, in the header, I've included
    stdio, stdlib, and windows.h (and some of my own files as well).

    If anyone has experience with this and has a hint of what the problem might be, it would be greatly appreciated, thanks!

  2. #2
    Unregistered
    Guest
    The first thing that comes to mind is wild, stray and dangling pointers.

  3. #3
    Unregistered
    Guest
    Originally posted by Unregistered
    The first thing that comes to mind is wild, stray and dangling pointers.
    Could you please be more specific? What do you mean and how do I fix it?

  4. #4
    Unregistered
    Guest
    Does all your pointers point to valid addresses. When a pointer go out of scoop do you set it to /0 ? When you assign memory with new to you use delete on them when you are done? Basicaly are you handling your pointers correct.

  5. #5
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    now lets think about what you said:
    I wrote a program (actually a game) in Windows XP (pro) using Dev-C/C++ compiler (www.bloodshed.net). I run the game on Windows XP and Windows 2000 systems just fine, but when I try to run it on Windows ME and '98, it crashes with an error:
    probably because the code varries for OS and platform
    ME & 98 are VERY different from NT and XP
    The Kernel is also different so the memory and addresses that is used in XP and 2k will vary because 98 and ME kernels are plug and play.

    Other reasons may exist but try rewriting the code to be 98 or ME specific.
    or use a wide range library like DirectX or something.

    a common reason is windows.h
    there are different versions and when compiled it runs different modules for the specific type of system
    Last edited by Lynux-Penguin; 05-14-2002 at 05:31 PM.
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  6. #6
    Unregistered
    Guest
    Originally posted by Lynux-Penguin
    probably because the code varries for OS and platform
    ME & 98 are VERY different from NT and XP
    The Kernel is also different so the memory and addresses that is used in XP and 2k will vary because 98 and ME kernels are plug and play.

    Other reasons may exist but try rewriting the code to be 98 or ME specific.
    or use a wide range library like DirectX or something.

    a common reason is windows.h
    there are different versions and when compiled it runs different modules for the specific type of system
    I assumed that it was the problem but I don't know how to fix it. Hmm... if anyone can give me more specific advice, that would be appreciated but I'll try to read up more on the windows.h library, see what I come up with..

    Thanks

  7. #7
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    I am not skilled in Windows programming, if you asked me to port a RedHat specific to BSD, I could do it but not windows.
    try Google
    or MSDN (Nearly a joke)
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  8. #8
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Well first of all, you should of posted this under the windows board but anyways, the problem could be a few things, most likely you are trying to use a function that is unsuported on the 98/Me platform. Try debuging your program and find what function call causes the crash, also try calling GetLastError and then look up the error code in msdn.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    now lets think about what you said:

    probably because the code varries for OS and platform
    ME & 98 are VERY different from NT and XP
    The Kernel is also different so the memory and addresses that is used in XP and 2k will vary because 98 and ME kernels are plug and play.

    Other reasons may exist but try rewriting the code to be 98 or ME specific.
    or use a wide range library like DirectX or something.

    a common reason is windows.h
    there are different versions and when compiled it runs different modules for the specific type of system[/B]
    Yes but as long as he sticks to proper libraries that call API functions he should be ok..........unless he is getting very involved with his code (IE calling functions specific to WinNT and above that are not even implemented in Win98). The key is to always check the return of API functions and error guard your code properly when you get a bad return.

    There is no simple answer to your problem........try to add error handlers to find the point where it crashes, or even better - run the code through a debugger

  10. #10
    Unregistered
    Guest
    LOL!!

    Well I decided to go the old fashioned way and test the program line by line until I found the mistake, oh boy was it a stupid one. But isn't it always?

    basically I gave inproper args for SetConsoleCursorInfo. I think sometime a few days ago I was trying some stuff and I forgot to erase it after I was done with it.. for some reason neither the compiler nor windows xp picked up the error.. oh well, got it now so it's all good..

    thanks for everyone's help

    /me smacks himself

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-01-2007, 01:06 AM
  2. Replies: 5
    Last Post: 07-13-2003, 01:01 PM
  3. kernel32.dll
    By Fluffy_Bunny in forum C++ Programming
    Replies: 7
    Last Post: 07-15-2002, 01:59 AM
  4. Kernel32.dll, loadlibary() and GetProcAddress()
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 12-03-2001, 06:33 AM
  5. Deformities caused by programming....
    By Aran in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-30-2001, 12:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21