| 
		
	
	
	
		
	Posts: 19Threads: 0
 Joined: 09.06.2024
 
	
	
		Hi Alison, Got it!. But you can generate An asm function in a completely separate program, extract the binary and chop it about as you please. The advantage of Asm is that you can create custom fully relocatable code without any telltale PB function headers/tails.
 Anyway, I trust this is for an ethical purpose. There was a system policy call DEP (Data Execution Prevention) to inhibit malware, and hackers. I don't know what the current status of DEP is in Windows. To be compliant with this policy, OxygenBasic executes its JIT binaries in system allocated memory, not in data memory, or on the stack. It can't be peeked at run-time.
 
https://github.com/Charles-Pegge/OxygenBasichttps://forum.it-berater.org/index.php
 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
	
		Quote:But you can generate An asm function in a completely separate program, extract the binary and chop it about as you please. The advantage of Asm is that you can create custom fully relocatable code without any telltale PB function headers/tails.  
  How to do that ?   
 Quote:I trust this is for an ethical purpose 
 Yes,  this is for an ethical purpose -- it is use to counter Reverse Engineering by hackers.
 
Hackers will use decompiler like IDA Pro to disassemble a program into C or ASM.  
They will trace through the control flows of the program and then to modify it by  
removing any protection system or password.  Once these protection are removed, 
the hacker will resell the program at a fraction of the cost of the original program.
	 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
		
		
		05.02.2025, 07:21 AM 
(This post was last modified: 05.02.2025, 07:24 AM by Anne Wilson.)
		
	 
		Quote:To be compliant with this policy, OxygenBasic executes its JIT binaries in system allocated memory, not in data memory, or on the stack. It can't be peeked at run-time. 
 I haven't use OxygenBasic yet,  what is this JIT binaries ?     Does JIT means Just in Time ? 
 does it means a kind of runtime module where the OxygenBasic interprets the codes ?
 
It would be great to run some modules in the system memory which hackers cannot peek.
 
Only problem is to convert the PowerBasic codes to OxygenBasic.   
A lot of our codes are in DDT  ,  can OxygenBasic handle DDT ?
 
for example in PowerBasic DDT code is 
 Code:   %Widlg = 200%Htdlg = 140
 ' Create the dialog
 DIALOG NEW 0, "Color Dlg in Win10",,, %Widlg, %Htdlg, %WS_CAPTION OR %WS_SYSMENU OR _
 %WS_THICKFRAME OR  %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX, 0 TO hDlg
 
in OxygenBasic it could be some thing like ?  I'm not sure 
 Code: %Widlg = 200%Htdlg = 140
 ' Create the dialog
 hDlg = DIALOG(0, "Color Dlg in Win10", 0, 0, %Widlg, %Htdlg, _
 %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX)
 
	
	
	
		
	Posts: 19Threads: 0
 Joined: 09.06.2024
 
	
		
		
		05.02.2025, 10:40 AM 
(This post was last modified: 05.02.2025, 11:09 AM by Charles Pegge.)
		
	 
		On the Asm function question, I think you create labels then peek between the two CODEPTRs to get the binary. 
You can start with something really simple to check you have a viable system
 Code: MyFun:! mov eax,12345 'integer return value
 ! ret
 EndMyFun:
 
 'TESTING IN SITU:
 DIM p as DWORD
 DIM result as LONG
 p=CODEPTR(MyFun)
 DECLARE FUNCTION ReturnSome() AS LONG
 CALL DWORD p USING ReturnSome() TO result '12345
using parameters: (adding 2 longs)
 Code: MyFun:! mov eax,[esp+8]  'x
 ! add eax,[esp+4]  'y
 ! ret 8  ' dump 8 bytes of params and then return
 EndMyFun:
 'TESTING:
 dim x as long
 dim y as long
 dim r as long
 dim p as dword
 x=121
 y=2
 p=codeptr(MyFun)
 DECLARE FUNCTION add2longs(BYVAL x as long, BYVAL y as long) AS long
 call dword p using add2longs(x,y) to r '123
I hope this demonstrates the basics adequately . This is not tested PB code. I have not used PB for a very long time!
 
 
My colleague Roland Stowasser did a nuber of Dialog demos. They are all in OxygenBasic.zip in the demos\WinDynDialogs  folder.
 
Here is one called DDTequiv.o2bas Code: 'http://www.garybeene.com/power/pb-tutor-controls-imgbuttonx.htm
 'This short example creates a complete application with a single imgbuttonx control.
 'When clicked, the imgbuttonx control responds with a message.
 'This tutorial page discusses most of the statements used,
 'however the DDT, Controls, Messages, and Callback tutorials provide
 'background information that may be helpful in understanding the example.
 /*
 #Compile Exe
 #Resource "pb-test.pbr"
 Global hDlg As Dword
 Function PBMain() As Long
 Dialog New Pixels, 0, "ImgButtonX Test",300,300,200,200, _
 %WS_SysMenu, 0 To hDlg
 Control Add ImgButtonX, hDlg, 100,"cowgirl", 50,50,100,100
 Dialog Show Modal hDlg Call DlgProc
 End Function
 
 CallBack Function DlgProc() As Long
 If Cb.Msg = %WM_Command And Cb.Ctl = 100 And _
 Cb.CtlMsg = %BN_Clicked Then
 MsgBox "Pushed!"
 End If
 End Function
 */
 
 '====================================================================
 ' Simple modal dialog as main.
 '====================================================================
 
 $ filename "DDTequiv.exe"
 'uses rtl32
 'uses rtl64
 
 '% review
 
 uses dialogs
 
 #define IDD_DLG1 1000
 #define IDC_BTN1 1001
 
 ==============================================
 
 'MAIN CODE
 =============================================
 
 'dim nCmdline as asciiz ptr, hInstance as sys
 '&nCmdline = GetCommandLine
 'hInstance = GetModuleHandle(NULL)
 
 
 function DialogProc( sys hDlg, uint uMsg, sys wParam, lParam ) as int callback
 float pixelX, pixelY
 
 sys Button=GetDlgItem(hDlg, IDC_BTN1)
 
 select case uMsg
 
 case WM_INITDIALOG
 RECT rc = {0, 0, 4, 8}
 MapDialogRect (hDlg, @rc)
 PixelX = rc.right/4
 pixelY = rc.bottom/8
 
 
 int width=65*pixelX
 int height =65*pixelY
 sys hBmp=LoadImage(hDlg,"mask2.bmp",IMAGE_BITMAP, width,height, LR_LOADFROMFILE )
 SendMessage (Button, BM_SETIMAGE, IMAGE_BITMAP, hBmp)
 
 return true
 
 case WM_COMMAND
 select case loword(wParam)
 case 1001
 mbox "Pushed!"
 
 case IDCANCEL
 EndDialog( hDlg, null )
 end select
 
 case WM_CLOSE
 EndDialog( hDlg, null )
 
 end select
 
 return 0
 end function
 
 sub winmain()
 
 Dialog( 10,10,130,130, "ImgButton Test",
 WS_POPUP|WS_VISIBLE|WS_CAPTION|WS_SYSMENU or DS_CENTER or DS_SETFONT,
 8,"MS Sans Serif" )
 CONTROL "IDC_BTN",IDC_BTN1,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP or BS_BITMAP or WS_DLGFRAME,32,32,65,65
 
 CreateModalDialog( null, @DialogProc, 0 )
 end sub
 
 winmain()
 Quote: what is this JIT binaries ?     Does JIT means Just in Time ? 
Programs can be run directly from source code in memory without producing a binary. Instead, the compiled image is assigned to allocated memory and executed directly. Just in Time   . Saves a lot of EXE clutter for small to medium sized programs.
	
https://github.com/Charles-Pegge/OxygenBasichttps://forum.it-berater.org/index.php
 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
		
		
		05.02.2025, 03:44 PM 
(This post was last modified: 05.02.2025, 04:49 PM by Anne Wilson.)
		
	 
		Thanks so much Charles 
Regarding your OxygenBasic code
 Code: MyFun:! mov eax,12345 'integer return value
 ! ret
 EndMyFun:
 
 'TESTING IN SITU:
 DIM p as DWORD
 DIM result as LONG
 p=CODEPTR(MyFun)
 DECLARE FUNCTION ReturnSome() AS LONG
 CALL DWORD p USING ReturnSome() TO result '12345
This is quite similar to PowerBasic when we use CODEPTR()  to a function ,  
 however in my "obfuscator Maker.bas"  above,   I saved the  opcode into a hex string 
 using the  SUB Obtain_PtrStringGen()  then I can reuse the hex string in another program 
 called  BB.bas say. 
 
That means the original function code isnot listed nor compile  inside BB.bas  
that's how CALL DWORD opcode method works.  It uses ONLY the hex string  which  
can be hidden or obfuscated.
 
 
I will illustrate the use of Hex string with a simplified program
 
Hence  for example usage of this method, I have listed below the program  
called "Obfuscator Maker Simple.bas"  in order to create the Hex string for  
one function -- Multiply 2 numbers.  
 
The Hex string is then obtained from its output file "Output WsAsm  1.txt" 
when we execute the  "Obfuscator Maker Simple.Exe"
 Code: ' Obfuscator Maker Simple.bas
 ' Inspired by Pierre
 ' https://forum.powerbasic.com/forum/user-to-user-discussions/programming/838669-calling-opcode-string-discussion?p=838671#post838671
 ' http://pump.richheimer.de/showthread.php?tid=21&pid=78#pid78
 
 ' This program makes obfuscator hex strings of a given function
 ' and save this string into a txt file, which can then be deployed
 ' to other programs
 ' It is used to test out functions before deployment
 
 
 ' This is a simplified version of Obfuscator Maker.bas as it uses
 ' only one function for multiplication
 
 #COMPILE EXE
 #DIM ALL
 
 #INCLUDE "Win32Api.inc"
 
 
 GLOBAL hDlg AS DWORD
 
 ' pointers params for the Multiplication function
 GLOBAL pStringMult , pcodeMult  AS DWORD
 GLOBAL sAsmMult      AS STRING
 
 
 
 
 $AppName    = "Simple Obfuscator Maker  "
 %Lab01      = 101
 %ButtonMult = 201
 
 
 
 
 ' To convert Hex to text use https://www.rapidtables.com/convert/number/hex-to-ascii.html
 ' End of function marker to indicate the final end of function ëFxtMðÞ
 '  ë           F     x     t     M      ð     Þ
 MACRO FN_END     = ! DB &HEB, &H08, &H46, &H78, &H74, &H4D, &hF0 , &HDE, &H00, &H00
 
 
 
 
 
 
 'for call dword usage -- for Masquerading  the real functions
 ' for the multiplication function
 DECLARE FUNCTION MasqueradeMt(BYVAL var1 AS LONG ,BYVAL var2 AS LONG) AS LONG
 ' Function declaration string
 $DecFnStr1 = "DECLARE FUNCTION MasqueradeMt(BYVAL var1 AS LONG ,BYVAL var2 AS LONG) AS LONG"
 
 
 
 
 
 
 ' place your functions to be obfuscated here ********************
 
 '===================================
 ' a simple multiplication function
 FUNCTION Mult2Numbers(BYVAL var1 AS LONG , BYVAL var2 AS LONG) AS LONG
 
 
 FUNCTION = var1 * var2
 EXIT FUNCTION
 ' End of function marker to indicate the final end of function
 FN_END
 END FUNCTION
 
 
 
 
 '==================================
 '  Setup functions' parameters into Opcode strings
 SUB SetupFunParams
 
 '  Get ready with these function params
 
 ' for the Mult2Numbers function
 pcodeMult = CODEPTR(Mult2Numbers)
 '   Obtain the pointer to the ASM string for the
 '   Mult2Numbers function
 Obtain_PtrStringGen( pcodeMult , pStringMult , sAsmMult , 1 )
 
 END SUB
 
 
 
 
 
 
 
 '============================
 FUNCTION PBMAIN()
 #REGISTER NONE
 
 ' Setup functions' parameters
 SetupFunParams
 
 DIALOG FONT "Segoe UI", 9
 DIALOG NEW %HWND_DESKTOP, $AppName, , , 250, 120, _
 %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_SIZEBOX _
 OR %WS_SYSMENU, %WS_EX_LEFT TO hDlg
 
 CONTROL ADD LABEL, hDlg, %Lab01 , "Obfuscate using String Pointers to functions",_
 15, 10, 190, 11
 
 CONTROL ADD BUTTON, hDlg, %ButtonMult ,  "Mult function strptr()",_
 55, 35, 90, 15
 
 DIALOG SHOW MODAL hDlg CALL DlgProc
 
 END FUNCTION
 
 
 
 
 
 
 '====================================
 CALLBACK FUNCTION DlgProc
 
 
 LOCAL RetVal  AS LONG
 
 
 LOCAL dispst AS STRING
 
 SELECT CASE CB.MSG
 
 CASE %WM_INITDIALOG
 
 
 
 CASE %WM_COMMAND
 SELECT CASE CB.CTL
 
 CASE %ButtonMult
 ' compute -- You need to TEST the function out
 ' so that it is accurate before deployment
 ' Simple Multiplication of 2 numbers
 IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
 RetVal = 0
 ' using string pointer to point to the Mult2Numbers function
 CALL DWORD pStringMult USING  MasqueradeMt(519, 23) TO RetVal
 MessageBox(hDlg, "CALL DWORD pStringMult result of 519 and 23 =" & _
 STR$(RetVal), "String Pointer to Mult function", 266240)
 END IF
 
 
 END SELECT
 
 END SELECT
 
 END FUNCTION
 
 
 
 
 
 
 
 '=========================
 '  Obtain the pointer to the ASM string
 '  for General usage.
 '  and creates the text file for the wsAsm string
 '  gpar = indicator for a specific function
 SUB Obtain_PtrStringGen( BYVAL gpcode AS DWORD, _
 BYREF WpString AS DWORD ,BYREF wsAsm  AS STRING , gpar AS LONG )
 
 LOCAL byteVal AS BYTE
 
 LOCAL sTerm AS STRING
 '         1   2     3     4     5     6     7      8     9    10
 sTerm = CHR$( &HEB, &H08, &H46, &H78, &H74, &H4D, &hF0 , &HDE, &H00, &H00)
 
 ' clear off any prev values
 WpString = 0
 wsAsm    = ""
 
 
 ' Assemble WsAsm byte by byte
 ' and looking for the end of function marker
 DO
 WsAsm &= PEEK$(gpcode, 1)
 INCR gpcode
 IF INSTR(WsAsm, sTerm )    THEN
 'found the end of function marker
 '  WsAsm &= PEEK$(gpcode, 16)      ' works
 WsAsm &= PEEK$(gpcode, 20)    ' works
 EXIT DO
 END IF
 LOOP
 
 
 
 ' Gets the pointer to the wanted function's ASM string
 WpString = STRPTR(WsAsm)
 
 ' Convert to hex as it is printable
 LOCAL HxStrAsm , OrigAsm AS STRING
 HxStrAsm = HexDump(WsAsm)
 SLEEP 10
 OrigAsm  = DeHex(HxStrAsm)
 SLEEP 10
 
 LOCAL filNamAsm , DecFn AS STRING
 filNamAsm = "Output WsAsm " + STR$(gpar) +  ".txt"
 
 ' gets the correct declaration function name
 ' according to gpar
 SELECT CASE gpar
 CASE  1
 DecFn = $DecFnStr1
 CASE ELSE
 DecFn = "Wrong choice"
 END SELECT
 
 ' clear off old file
 KILL  filNamAsm
 '  prints out the WsAsm string to a text file
 LOCAL bf AS LONG
 bf = FREEFILE
 OPEN filNamAsm FOR OUTPUT AS #bf
 PRINT #bf, WsAsm
 PRINT #bf,
 PRINT #bf,
 PRINT #bf,HxStrAsm
 PRINT #bf,
 PRINT #bf,
 PRINT #bf, OrigAsm
 PRINT #bf,
 PRINT #bf,
 PRINT #bf, "Masquerade Function declaration string"
 PRINT #bf, DecFn
 
 CLOSE #bf
 
 END SUB
 
 
 
 
 
 
 
 
 '======================================
 '  Provide a string of Hex characters
 '  for a given string sgBuf
 FUNCTION HexDump(sgBuf AS STRING) AS STRING
 LOCAL sbh AS ISTRINGBUILDERA
 sbh = CLASS "STRINGBUILDERA"
 LOCAL ihd AS LONG
 FOR ihd = 1 TO LEN(sgBuf)
 sbh.add  HEX$(ASC(MID$(sgBuf,ihd,1)),2)
 NEXT
 FUNCTION = sbh.string
 END FUNCTION
 
 
 
 '===================================================
 FUNCTION DeHex(Inpt AS STRING) AS STRING
 LOCAL i AS INTEGER
 LOCAL Xdh AS STRING
 
 FOR i = 1 TO LEN(Inpt) STEP 2
 Xdh = Xdh & CHR$(VAL("&H" & MID$(Inpt, i, 2)))
 NEXT i
 DeHex = Xdh
 END FUNCTION
This is the  "Output WsAsm  1.txt"   as output by the above program.
 Code: U‹ìSVWh?  ƒìphƒ  1öVVVVV‹E÷m‰…hÿÿÿéëFxtMðÞ  ‹…hÿÿÿeô_^[]Â
 
 
 558BEC535657683F13000083EC70688310200031F656565656568B450CF76D08898568FFFFFFE90A000000EB084678744DF0DE00008B8568FFFFFF8D65F45F5E5B5DC2080000000000
 
 
 U‹ìSVWh?  ƒìphƒ  1öVVVVV‹E÷m‰…hÿÿÿé
 ëFxtMðÞ  ‹…hÿÿÿeô_^[]Â
 
 
 Masquerade Function declaration string
 DECLARE FUNCTION MasqueradeMt(BYVAL var1 AS LONG ,BYVAL var2 AS LONG) AS LONG
 
Now we can create another program  called  "Obfus Simple.bas"  to use this Hex string 
obtained from the "Obfuscator Maker Simple.exe"  above
 Code: ' Obfus Simple.bas
 ' Inspired by Pierre
 ' https://forum.powerbasic.com/forum/user-to-user-discussions/programming/838669-calling-opcode-string-discussion?p=838671#post838671
 
 ' This program use the Hex string provided by Obfuscator Maker Simple.bas
 ' for the Multiplication function
 ' Note that the Multiplication function code is NOT listed in this program
 
 #COMPILE EXE
 #DIM ALL
 
 #INCLUDE "Win32Api.inc"
 
 
 GLOBAL hDlg AS DWORD
 
 ' pointers params
 
 GLOBAL pStringMult  AS DWORD
 
 GLOBAL sAsmMult   AS STRING
 
 
 
 $AppName  = " Strings pointer Obfuscator Simple"
 %Lab01      = 101
 
 %ButtonMult = 202
 
 
 'for call dword usage -- for Masquerading real functions
 DECLARE FUNCTION MasqueradeMt(BYVAL var1 AS LONG ,BYVAL var2 AS LONG) AS LONG
 
 
 
 
 
 '==================================
 '  Setup functions' pointers
 SUB SetupFunPtr
 LOCAL sAsmMultHx , stMultHx AS STRING
 
 '  Get ready with these pointers
 
 
 ' Mult2Numbers Multiplication function -- place in the Hex string stMultHx
 ' obtained from Obfuscator Maker Simple.bas program
 stMultHx ="558BEC535657683F13000083EC70688310200031F656565656568B450CF76D08898568FFFFFFE90A000000EB084678744DF0DE00008B8568FFFFFF8D65F45F5E5B5DC2080000000000"
 sAsmMultHx  = StMultHx
 sAsmMult    = DeHex(sAsmMultHx)
 pStringMult = STRPTR(sAsmMult)
 
 
 
 END SUB
 
 
 
 
 '============================
 FUNCTION PBMAIN()
 #REGISTER NONE
 
 ' Setup functions' pointers
 SetupFunPtr
 
 DIALOG FONT "Segoe UI", 9
 DIALOG NEW %HWND_DESKTOP, $AppName, , , 250, 180, _
 %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX OR %WS_SIZEBOX _
 OR %WS_SYSMENU, %WS_EX_LEFT TO hDlg
 
 CONTROL ADD LABEL, hDlg, %Lab01 , "Obfuscate using String Pointers to functions",_
 15, 10, 190, 11
 
 
 CONTROL ADD BUTTON, hDlg, %ButtonMult, "Mult2Numbers function strptr()",_
 65, 65, 110, 15
 
 
 DIALOG SHOW MODAL hDlg CALL DlgProc
 
 END FUNCTION
 
 
 
 
 
 
 '====================================
 CALLBACK FUNCTION DlgProc
 
 
 LOCAL RetVal  AS LONG
 
 SELECT CASE CB.MSG
 
 CASE %WM_INITDIALOG
 
 
 CASE %WM_COMMAND
 SELECT CASE CB.CTL
 
 
 
 CASE %ButtonMult
 ' compute the  multiplication of 2 numbers
 IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
 RetVal = 0
 ' using string pointer to point to the matrix function
 CALL DWORD pStringMult USING MasqueradeMt(103,81) TO RetVal
 
 MessageBox(hDlg, "CALL DWORD pStringMult result of 103 and 81 = " & _
 STR$(RetVal), "String Pointer to Mult2Numbers function", 266240)
 END IF
 
 
 END SELECT
 
 END SELECT
 
 END FUNCTION
 
 
 
 
 
 
 '======================================
 '  Provide a string of Hex characters
 '  for a given string sgBuf
 FUNCTION HexDump(sgBuf AS STRING) AS STRING
 LOCAL sbh AS ISTRINGBUILDERA
 sbh = CLASS "STRINGBUILDERA"
 LOCAL ihd AS LONG
 FOR ihd = 1 TO LEN(sgBuf)
 sbh.add  HEX$(ASC(MID$(sgBuf,ihd,1)),2)
 NEXT
 FUNCTION = sbh.string
 END FUNCTION
 
 
 
 '===================================================
 FUNCTION DeHex(Inpt AS STRING) AS STRING
 LOCAL i AS INTEGER
 LOCAL Xdh AS STRING
 
 FOR i = 1 TO LEN(Inpt) STEP 2
 Xdh = Xdh & CHR$(VAL("&H" & MID$(Inpt, i, 2)))
 NEXT i
 DeHex = Xdh
 END FUNCTION
Note that we use the Hex string ONLY  and no more listing of the Multiplication of 2 numbers function 
inside this new program  "Obfus Simple.bas"   and this can run fairly well
 Code: 558BEC535657683F13000083EC70688310200031F656565656568B450CF76D08898568FFFFFFE90A000000EB084678744DF0DE00008B8568FFFFFF8D65F45F5E5B5DC2080000000000
It can run well provided that the function is very simple multiplication , addition and division of LONG  
variables and it GPF if the function calls external PowerBasic function or WinAPI functions.
 
The Hex string can be encrypted as well so that it would be difficult for hackers to decompile 
the program.
	 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
	
		Thanks Charles
 The  DDTequiv.o2bas  program is truly good for PowerBasic conversion to OxygenBasic as
 we have lots of DDT programs.
 
 I heard that OxygenBasic doesn't have an IDE ?  Is that true?
 
	
	
	
		
	Posts: 19Threads: 0
 Joined: 09.06.2024
 
	
		
		
		05.02.2025, 06:27 PM 
(This post was last modified: 05.02.2025, 06:35 PM by Charles Pegge.)
		
	 
		This code is written and tested in OxygenBasic. I don't normally capitalize but as a demo, this makes the keywords obvious. It could be used for generating any opcode strings. I will add it to the \tools  folder. You can see the differences with PowerBasic, For instance '@' instead of CODEPTR.
 
I should add that you can work with floats, and potentially API calls depending on how Bob maps them into the system. The calls are usually from a table of absolute addresses.
 
Oxygen comes with 2 mini IDES:
Oxide  is considered rather primitive, but it is a demo and could be useful for anyone to expand.
Peroxide  is really bare-metal but with very strong keyword search. It is my personal tool for managing Oxygen code
 
But for simple programming Notepad does the job, particularly for JIT where you just click on any .o2bas source file to run.
 
Pierre has expertise on IDEs. Is it UltraEdit?
 Code: '05/02/2025
 USES CONSOLE
 '
 GOTO TESTING
 
 MyFun:
 mov eax,[esp+8]  'x
 add eax,[esp+4]  'y
 ret 8
 ' dump 8 bytes of params and then return
 EndMyFun:
 
 TESTING:
 ========
 
 DIM x,y AS LONG
 x=121
 y=2
 DECLARE FUNCTION PTR add2longs(BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
 @add2longs=@MyFun 'link addresses
 
 'TEST THE FUNCTION:
 
 PRINT "test result: " add2longs(x,y) CR CR '123 ok
 '
 'CAPTURE BINARY STRING
 '
 DIM le AS LONG = @EndMyFun-@MyFun
 DIM bins AS STRING = SPACE(le)
 COPY STRPTR(bins), @MyFun,le
 PRINT le CR '11 bytes
 PRINT CR
 '
 'CHECK CAPTURED OPCODES
 '
 INDEXBASE 1
 DIM i AS LONG
 DIM byte PTR bt : @bt=STRPTR(bins)
 FOR i=1 TO le
 PRINT HEX(bt[i],2) " "
 NEXT
 PRINT CR CR
 'result 8B 44 24 08 03 44 24 04 C2 08 00
 '
 'SAVE THE BIN STRING TO FILE
 '
 PRINT "Enter FileName to Save: "
 STRING s=INPUT()
 s=LTRIM(RTRIM(S))
 IF s
 PUTFILE(s,bins)
 PRINT "ok"
 WAIT
 ENDIF
https://github.com/Charles-Pegge/OxygenBasichttps://forum.it-berater.org/index.php
 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
	
		Quote:Programs can be run directly from source code in memory without producing a binary. Instead, the compiled image is
 assigned to allocated memory and executed directly. Just in Time
 
 I'm not sure I understood JIT ,  does it means that you can use a JIT 
module to interpret a source code program so that it runs in system  
memory.  
 
But hackers can easily open up the  source  code program and read its 
contents.  It is more like an interpreter ?   
There is no protection  against reverse engineering?  
 
Perhaps you can show me an example program with JIT module to see if 
it can be protected against.  BTW, please give me a link to download the 
OxygenBasic compiler and JIT module.  Thanks
	 
	
	
	
		
	Posts: 19Threads: 0
 Joined: 09.06.2024
 
	
		
		
		05.02.2025, 07:09 PM 
(This post was last modified: 05.02.2025, 07:13 PM by Charles Pegge.)
		
	 
		The code gets fully compiled but is run directly in memory instead of loading an EXE (PE) file. This feature is not intended for finished apps to commercial customers. 
A simple progam:
 Code: print "Hello World!"
This is all you need to run in JIT mode.  
To compile to an exe or DLL. Your source code would look like this:
 Code: $ filename "t.exe"uses RTL32 ' or RTL64
 print "Hello World!"
To make a DLL:
 Code: $ DLL$ filename "t.exe"
 uses RTL32 ' or RTL64
 function hello() export
 print "Hello World!"
 end function
Extract the file and place it wherever convenient. To run .o2bas files JIT, open 'properties' for any o2bas file and configure opens with:
 co2.exe 
Apart from this, no further configuration is needed.
 
OxygenBasic.zip can be downloaded from Github. @ My signature below.
	
https://github.com/Charles-Pegge/OxygenBasichttps://forum.it-berater.org/index.php
 
	
	
	
		
	Posts: 23Threads: 5
 Joined: 18.05.2024
 
	
	
		Quote:To run .o2bas files JIT, open 'properties' for anyo2bas file and configure opens with:
 co2.exe
 
What I'm saying is this  that running the source code  o2bas file  using cO2.exe . 
Then this source code  o2bas file  would be provided as an open dish to the hackers !!!
 
Ok, what about the compile  exe file ( compiled under OxygenBasic) , does it reside in the 
system memory  when we run it. ?  
Are there ways to make the exe file to be able run inside the system memory independently ?
 
Clearly, the exe file (being in machine code) would be much better in terms of copy protection 
 than an  o2bas file running with co2.exe. 
 
Another question is that does OxygenBasic has an IDE like in PowerBasic?
	 |