flat assembler
Message board for the users of flat assembler.

Index > Windows > Can't GetModuleHandleA OPENGL32.DLL [solved, thanks]

Thread Post new topic Reply to topic

Joined: 29 Oct 2016
Posts: 671
vivik 17 Dec 2016, 10:43
Hello. I have this weird problem, KERNEL32.DLL and USER32.DLL are loading properly, but with OPENGL32.DLL I'm getting ERROR_MOD_NOT_FOUND (0000007E).

Opengl works from normal executables, but not if I try to GetModuleHandle it. It doesn't load opengl32.dll, opengl.dll, OPENGL.DLL either.

Here is a little program to check if it works from your computer. (compiled version in attachment). Please check it.

include 'win32ax.inc'


    invoke GetModuleHandleA, "OPENGL32.DLL"
    test eax,eax
    jz fail
    invoke MessageBox,0,"SUCCESS!!! IT WORKS!!","YES!",0
    jmp exit
    invoke MessageBox,0,"nope, returned zero","error",0
    invoke ExitProcess,0

.end start

Filename: hello-opengl.zip
Filesize: 558 Bytes
Downloaded: 379 Time(s)

Last edited by vivik on 17 Dec 2016, 11:39; edited 1 time in total
Post 17 Dec 2016, 10:43
View user's profile Send private message Reply with quote
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 20210
Location: In your JS exploiting you and your system
revolution 17 Dec 2016, 11:08
GetModuleHandle only "works" if the DLL has already been linked to you executable. Sometimes other DLLs will link to OPENGL32, even if you don't, and it will be linked because those other modules request it. Otherwise you will get an error. If you want to load it then use LoadLibrary.
Post 17 Dec 2016, 11:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.