Finding a bug when Purifier and line numbering doesn't help?

Everything else that doesn't fall into one of the other PB categories.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by juergenkulow »

Error Code : 0x2147483651
Your error code is a decimal value, but is marked as a hexidecimal value (0x). The test should output 0x80000003 and appear in the NTSTATUS Values table.
Whether these links from Microsoft will help, who knows:
Tips for software engineers
Bug check 0x1E: KMODE_EXCEPTION_NOT_HANDLED with more
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by BarryG »

@normeus: Yes, my app is indeed loading "oleacc.dll" but without a direct path. Currently like this:

Code: Select all

Global oleacc=OpenLibrary(#PB_Any,"oleacc.dll")
This was because I used this code -> https://www.purebasic.fr/english/viewto ... 29#p495029

So basically are you saying I should be hard-coding all system OpenLibrary() commands now with their full path?

@skywalk: I was able to finally ditch the last ASM code I had, so I'll try compiling with the C backend instead of ASM.

@tored: I will try that for a few days and see how it goes. No threads read the same memory; they only manipulate their own local protected variables. No GUI updates in those threads.

@juergenkulow: The decimal error value is because I was using this code -> https://www.purebasic.fr/english/viewto ... 92#p491192

It has these lines, but I changed "Exception" to "Error Code":

Code: Select all

Procedure.s DecodeException(e.i)
[...]
sCode.s = "Exception 0x" + Hex(e) + " (" + Str(e)+") <undefined>"
tored
User
User
Posts: 86
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by tored »

BarryG wrote: Wed Mar 06, 2024 10:08 am So basically are you saying I should be hard-coding all system OpenLibrary() commands now with their full path?
Yes, that is also to prevent what is called DLL hijacking.

https://stackoverflow.com/questions/352 ... -hijacking
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by BarryG »

Doesn't the new compiler option to prevent DLL hijacking do that? I guess I can hard-code the path anyway.
normeus
Enthusiast
Enthusiast
Posts: 470
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by normeus »

BarryG,
At least Hard code oleacc.dll:

Code: Select all

Global oleacc=OpenLibrary(#PB_Any,"C:\Windows\System32\oleacc.dll")
I have 29 different instances of "oleacc.dll" at least 6 of those in "C:\Windows\" under different folders on one of my computers. I think part of it might be from upgrading from Windows 7 to Windows 10. Some of your customer computers could've been upgraded that way, so the dll from microsoft gets loaded, but it might not respond the way you expect it because it is an older version.

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by BarryG »

Thanks for the info, Norm. I had no idea that DLL could be in so many places. I will hard-code all system DLLs to use the "System32" folder.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by juergenkulow »

Is there any experience to get the current lines of the threads and the main program and to save them by another program not simultaneously terminated by the operating system by redefining DBG_Check?

Code: Select all

!#define DBG_Check(n) 
tored
User
User
Posts: 86
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by tored »

Does the Event log in Windows say anything?

Does it depend on Windows version?
tored
User
User
Posts: 86
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by tored »

Turn on auditing of processes in Windows to get event logs when processes starts and ends with error code.

https://superuser.com/a/964667
User avatar
mk-soft
Always Here
Always Here
Posts: 6206
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Finding a bug when Purifier and line numbering doesn't help?

Post by mk-soft »

Smal Helpcode for Memory functions ...

Code: Select all

;-TOP
;
; Memory Debugging v0.4

CompilerIf #PB_Compiler_Debugger
  
  #MemoryStop = 1
  
  Global NewMap MemID()
  
  Procedure MyAllocateMemory(Size, Flags, Proc.s)
    Protected *mem
    *mem = AllocateMemory(Size, Flags)
    If *mem
      MemID(Hex(*mem)) = *mem
    Else
      DebuggerWarning("AllocateMemory: Out Of Memory : Proc /" + Proc)
      CompilerIf #MemoryStop : CallDebugger : CompilerEndIf
      ProcedureReturn #False
    EndIf
    ProcedureReturn *mem
  EndProcedure
  
  Procedure MyFreeMemory(Memory, Proc.s)
    If FindMapElement(MemID(), Hex(Memory))
      FreeMemory(Memory)
      DeleteMapElement(MemID())
      ProcedureReturn #True
    Else
      DebuggerWarning("FreeMemory: Memory not exists : Proc /" + Proc)
      CompilerIf #MemoryStop : CallDebugger : CompilerEndIf
      ProcedureReturn #False
    EndIf
  EndProcedure
  
  Procedure MyMemorySize(Memory, Proc.s)
    If FindMapElement(MemID(), Hex(Memory))
      ProcedureReturn MemorySize(Memory)
    Else
      DebuggerWarning("MemorySize: Memory not exists : Proc /" + Proc)
      CompilerIf #MemoryStop : CallDebugger : CompilerEndIf
      ProcedureReturn 0
    EndIf
  EndProcedure
  
  Macro AllocateMemory(Size, Flags=0)
    MyAllocateMemory(Size, Flags, #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + "() - Line " + #PB_Compiler_Line)
  EndMacro
  
  Macro FreeMemory(Memory)
    MyFreeMemory(Memory, #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + "() - Line " + #PB_Compiler_Line)
  EndMacro
  
  Macro MemorySize(Memory)
    MyMemorySize(Memory, #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + "() - Line " + #PB_Compiler_Line)
  EndMacro
  
CompilerEndIf

;- test

CompilerIf #PB_Compiler_IsMainFile
  
  Procedure Main()
    *mem1 = AllocateMemory(1024)
    ;*mem2 = AllocateMemory(2048)
    
    Debug "Size 1: " + MemorySize(*mem1)
    Debug "Size 2: " + MemorySize(*mem2)
    
    Debug "Free 1: " + FreeMemory(*mem1)
    Debug "Free 2: " + FreeMemory(*mem2)
  EndProcedure : main()
  
CompilerEndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply