ShadowStorm wrote: Wed Feb 12, 2025 4:25 am
At the end of the day: Not a single one produces usable code; even for hello-world in a lot of cases..
I think you're talking nonsense !
ChatGPT 4
Code: Select all
Print("Hello, World!")
Input() ; Wait for user input to keep the console window open
[13:46:18] Waiting for executable to start...
[13:46:19] Executable type: Windows - x64 (64bit, Unicode)
[13:46:19] Executable started.
[13:46:19] [ERROR] Line: 1
[13:46:19] [ERROR] No console is currently opened. OpenConsole() must be called first.
Code: Select all
; System Information using msinfo32 in PureBasic
; Define an array to store system information
Define systemInfo.s(10)
; Define a temporary file to store the output of the msinfo32 command
Define tempFile.s = "msinfo_output.txt"
; Run msinfo32 and output to a file
RunProgram("msinfo32", "/report " + tempFile, "", #PB_Program_Wait)
; Wait for the process to finish (add a small delay)
Delay(1000)
; Open the temporary file to read the system information
If OpenFile(0, tempFile)
; Read lines from the file and store them in the array
Define line.s
Define index = 0
While Eof(0) = 0 And index < ArraySize(systemInfo)
line = ReadString(0)
systemInfo(index) = line
index + 1
Wend
CloseFile(0)
; Display the captured information from the array
For i = 0 To index - 1
Debug "Info " + Str(i + 1) + ": " + systemInfo(i)
Next
Else
MessageRequester("Error", "Unable to open the system information file.", #PB_MessageRequester_Ok)
EndIf
; Optionally, delete the temporary file after use
DeleteFile(tempFile)
[13:55:14] [COMPILER] Line 4: Illegal operator for 'Define'.
[13:55:54] [COMPILER] Line 20: Bad parameter type: an array is expected.
DeepSeek V3
Code: Select all
; Define the path to the output file
OutputFile$ = GetTemporaryDirectory() + "msinfo.nfo"
; Run msinfo32 and export the system information to the output file
RunProgram("msinfo32", "/nfo " + OutputFile$, "", #PB_Program_Wait)
; Open the output file for reading
If ReadFile(0, OutputFile$)
; Define an array to store the information
Dim SystemInfo$(0)
; Read the file line by line
While Eof(0) = 0
Line$ = ReadString(0)
; Add the line to the array
ReDim SystemInfo$(ArraySize(SystemInfo$()) + 1)
SystemInfo$(ArraySize(SystemInfo$()) - 1) = Line$
Wend
; Close the file
CloseFile(0)
; Display the information stored in the array
For i = 0 To ArraySize(SystemInfo$()) - 1
Debug SystemInfo$(i)
Next
Else
MessageRequester("Error", "Could not open the file: " + OutputFile$)
EndIf
lol
Code: Select all
; Import necessary Windows API functions
Prototype.i PFN_BCryptOpenAlgorithmProvider(*phAlgorithm, pszAlgId.p-unicode, pszImplementation.p-unicode, dwFlags.i)
Prototype.i PFN_BCryptGenerateSymmetricKey(*hAlgorithm, *phKey, *pbKeyObject, cbKeyObject.i, *pbSecret, cbSecret.i, dwFlags.i)
Prototype.i PFN_BCryptEncrypt(*hKey, *pbInput, cbInput.i, *pPaddingInfo, *pbIV, cbIV.i, *pbOutput, cbOutput.i, *pcbResult, dwFlags.i)
Prototype.i PFN_BCryptCloseAlgorithmProvider(*hAlgorithm, dwFlags.i)
Prototype.i PFN_BCryptDestroyKey(*hKey)
; Load the BCrypt library
If OpenLibrary(0, "Bcrypt.dll")
BCryptOpenAlgorithmProvider.PFN_BCryptOpenAlgorithmProvider = GetFunction(0, "BCryptOpenAlgorithmProvider")
BCryptGenerateSymmetricKey.PFN_BCryptGenerateSymmetricKey = GetFunction(0, "BCryptGenerateSymmetricKey")
BCryptEncrypt.PFN_BCryptEncrypt = GetFunction(0, "BCryptEncrypt")
BCryptCloseAlgorithmProvider.PFN_BCryptCloseAlgorithmProvider = GetFunction(0, "BCryptCloseAlgorithmProvider")
BCryptDestroyKey.PFN_BCryptDestroyKey = GetFunction(0, "BCryptDestroyKey")
Else
MessageRequester("Error", "Failed to load Bcrypt.dll")
End
EndIf
; Define constants
#BCRYPT_AES_ALGORITHM = "AES"
#BCRYPT_OBJECT_LENGTH = "ObjectLength"
#BCRYPT_BLOCK_PADDING = 1
; Initialize variables
hAlgorithm.i = 0
hKey.i = 0
pbKeyObject.i = 0
cbKeyObject.i = 0
pbIV.s = Space(16) ; Initialization Vector (16 bytes for AES)
pbSecret.s = "MySecretKey123" ; Secret key (must be 16, 24, or 32 bytes for AES)
cbSecret.i = Len(pbSecret)
pbInput.s = "Hello, World!" ; String to encrypt
cbInput.i = Len(pbInput)
pbOutput.s = Space(cbInput + 16) ; Output buffer (input size + padding)
cbOutput.i = Len(pbOutput)
pcbResult.i = 0
; Open an algorithm provider
If BCryptOpenAlgorithmProvider(@hAlgorithm, #BCRYPT_AES_ALGORITHM, #Null, 0) <> 0
MessageRequester("Error", "Failed to open algorithm provider")
End
EndIf
; Get the size of the key object
If BCryptGetProperty(hAlgorithm, #BCRYPT_OBJECT_LENGTH, @cbKeyObject, SizeOf(Integer), @pcbResult, 0) <> 0
MessageRequester("Error", "Failed to get key object size")
End
EndIf
; Allocate memory for the key object
pbKeyObject = AllocateMemory(cbKeyObject)
If pbKeyObject = 0
MessageRequester("Error", "Failed to allocate memory for key object")
End
EndIf
; Generate a symmetric key
If BCryptGenerateSymmetricKey(hAlgorithm, @hKey, pbKeyObject, cbKeyObject, @pbSecret, cbSecret, 0) <> 0
MessageRequester("Error", "Failed to generate symmetric key")
End
EndIf
; Encrypt the data
If BCryptEncrypt(hKey, @pbInput, cbInput, #Null, @pbIV, Len(pbIV), @pbOutput, cbOutput, @pcbResult, #BCRYPT_BLOCK_PADDING) <> 0
MessageRequester("Error", "Failed to encrypt data")
End
EndIf
; Display the encrypted data
MessageRequester("Encrypted Data", PeekS(@pbOutput, pcbResult))
; Clean up
If hKey <> 0
BCryptDestroyKey(hKey)
EndIf
If hAlgorithm <> 0
BCryptCloseAlgorithmProvider(hAlgorithm, 0)
EndIf
If pbKeyObject <> 0
FreeMemory(pbKeyObject)
EndIf
; Close the BCrypt library
CloseLibrary(0)
dumpster fire
Advice: If you're going to BS on the internet do it with something that takes longer than minutes to see flaws in.. Also.. again: Standardized..Benchmarks. AI isn't reliable(as indicated by ALL benchmarks) and you obviously know how it works and what it is.. Which one do you suggest for solving millennium problems? XD