UDRes Userlibrary (Userdefined Resources use and compile)
resources including all the functions in the .dll?ts-soft wrote:Update:
Added 2 FunctionsThe result is the ModuleHandle. With this, you can load all resources from included DLLCode: Select all
UDRes_GetModuleHandle(ResNumber.l [, hModule.l]) UDRes_GetPackModuleHandle(ResNumber.l [, hModule.l])
for functions:SFSxOI wrote: resources including all the functions in the .dll?
Code: Select all
UDRes_GetFunction()
UDRes_GetPackFunction()
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Update for compatible with PB4.30 (x86 only)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: UDRes Userlibrary (Userdefined Resources use and compile)
Hello!
Any chance for an update of this library for PB4.41? Tested the old one, it's truly great and it would be so handy for one of my planned progs. I want to develop this in the newest PB version though, which isn't compatible with UDRes
Pad
Any chance for an update of this library for PB4.41? Tested the old one, it's truly great and it would be so handy for one of my planned progs. I want to develop this in the newest PB version though, which isn't compatible with UDRes

Pad

Re: UDRes Userlibrary (Userdefined Resources use and compile)
after harddisk crash i have no source for this lib.
you can use PureDataConverter
you can use PureDataConverter
Re: UDRes Userlibrary (Userdefined Resources use and compile)
Aww too bad. I was especially after the easy DLL include, which was so damn handy. I'll have a look at PureDataConverter and see if I can get it to work with that. Thanks for the quick response!
Re: UDRes Userlibrary (Userdefined Resources use and compile)
You can include a DLL but the functions to using not included. I can give you a static lib,
created from memorymodule and a includefile for using, if required.
created from memorymodule and a includefile for using, if required.
Re: UDRes Userlibrary (Userdefined Resources use and compile)
Thanks for the kind offer, I'll get back at you if I can't get it to work, which I most definiteIy probably won't!
I can't test anything at the moment since I'm not at home.

Re: UDRes Userlibrary (Userdefined Resources use and compile)
Mate, you are my hero. Thank you so so much!
Cheers,
Pad
Cheers,
Pad

Re: UDRes Userlibrary (Userdefined Resources use and compile)
Tut tut, no backups!ts-soft wrote:after harddisk crash i have no source for this lib.
you can use PureDataConverter

I may look like a mule, but I'm not a complete ass.
Re: UDRes Userlibrary (Userdefined Resources use and compile
I tried to modify the example by changing the dll.ts-soft wrote:I have make a small example with all required files to include a 32-bit dll here.
greetings
Thomas
How do you generate the .res file ?
Re: UDRes Userlibrary (Userdefined Resources use and compile
Pureabc wrote:How do you generate the .res file ?
Code: Select all
CompilerIf Defined(compress2, #PB_Procedure) = #False
ImportC "zlib.lib"
compress2(*dest, *destLen, *source, sourceLen, level)
EndImport
CompilerEndIf
Enumeration
#UDRes_Packer_None
#UDRes_Packer_jCalg1
#UDRes_Packer_zip
EndEnumeration
CompilerIf Defined(UDResPack, #PB_Structure) = #False
Structure UDResPack
Size.q
CRC.q
Packer.b
Magic.b[6]
EndStructure
CompilerEndIf
CompilerIf Defined(_PackMemory, #PB_Procedure) = #False
Procedure _PackMemory(*SourceMemoryID, SourceLength, *DestionationMemoryID, DestLength, Level = 9, Packer = #UDRes_Packer_jCalg1)
Select Packer
Case #UDRes_Packer_jCalg1
ProcedureReturn PackMemory(*SourceMemoryID, *DestionationMemoryID, SourceLength, Level)
Case #UDRes_Packer_zip
If Not compress2(*DestionationMemoryID, @DestLength, *SourceMemoryID, MemorySize(*SourceMemoryID), Level)
ProcedureReturn DestLength
EndIf
EndSelect
EndProcedure
CompilerEndIf
Procedure UDRes_Create(ResFileName.s)
Protected FileID
FileID = CreateFile(#PB_Any, ResFileName)
If FileID
WriteLong(FileID, 0)
WriteLong(FileID, 32)
WriteLong(FileID, 65535)
WriteLong(FileID, 65535)
WriteLong(FileID, 0)
WriteLong(FileID, 0)
WriteLong(FileID, 0)
WriteLong(FileID, 0)
ProcedureReturn FileID
EndIf
EndProcedure
Procedure UDRes_Open(ResFileName.s)
Protected FileID
FileID = OpenFile(#PB_Any, ResFileName)
If FileID
FileSeek(FileID, Lof(FileID))
ProcedureReturn FileID
EndIf
EndProcedure
Procedure UDRes_Close(FileID)
ProcedureReturn CloseFile(FileID)
EndProcedure
Procedure UDRes_AddMem(FileID, *MemoryID, ResNumber, Packer = 0)
Protected DataSize, I, Mod
Protected *DestMEM.UDResPack
Protected Size, NewSize
If IsFile(FileID) = #False : ProcedureReturn #False : EndIf
If ResNumber < 1 : ProcedureReturn #False : EndIf
If Packer
If *MemoryID
Size = MemorySize(*MemoryID)
If Size
*DestMEM = AllocateMemory(Size + (SizeOf(UDResPack) + 12 + (Int(Size / 100) + 1)))
If *DestMEM
*DestMEM\Size = Size
*DestMEM\CRC = CRC32Fingerprint(*MemoryID, Size)
*DestMEM\Packer = Packer
*DestMEM\Magic[0] = 'P'
*DestMEM\Magic[1] = 'B'
*DestMEM\Magic[2] = 'D'
*DestMEM\Magic[3] = 'A'
*DestMEM\Magic[4] = 'T'
*DestMEM\Magic[5] = 'A'
NewSize = _PackMemory(*MemoryID, Size, *DestMEM + SizeOf(UDResPack), MemorySize(*DestMEM), 9, *DestMEM\Packer)
If NewSize
*DestMEM = ReAllocateMemory(*DestMEM, NewSize + SizeOf(UDResPack))
FreeMemory(*MemoryID)
*MemoryID = *DestMem
Else
FreeMemory(*DestMEM)
EndIf
EndIf
EndIf
EndIf
EndIf
If *MemoryID And MemorySize(*MemoryID) > 0
DataSize = MemorySize(*MemoryID)
WriteLong(FileID, DataSize)
WriteLong(FileID, 44)
WriteWord(FileID, 'P')
WriteWord(FileID, 'B')
WriteWord(FileID, 'D')
WriteWord(FileID, 'A')
WriteWord(FileID, 'T')
WriteWord(FileID, 'A')
WriteWord(FileID, 0)
WriteWord(FileID, $FFFF)
WriteWord(FileID, ResNumber)
For I = 1 To 4
WriteLong(FileID, 0)
Next
WriteWord(FileID, 0)
WriteData(FileID, *MemoryID, DataSize)
Mod = DataSize % 4
If Mod
Select Mod
Case 1 : WriteWord(FileID, 0) : WriteByte(FileID, 0)
Case 2 : WriteWord(FileID, 0)
Case 3 : WriteByte(FileID, 0)
EndSelect
EndIf
FreeMemory(*MemoryID)
ProcedureReturn #True
EndIf
EndProcedure
Procedure UDRes_AddFile(FileID, FileName.s, ResNumber, Packer = 0)
Protected FileR, Size
Protected *Mem
FileR = ReadFile(#PB_Any, FileName)
If FileR
Size = Lof(FileR)
*Mem = AllocateMemory(Size)
If *Mem
ReadData(FileR, *Mem, Size)
CloseFile(FileR)
ProcedureReturn UDRes_AddMem(FileID, *Mem, ResNumber, Packer)
EndIf
CloseFile(FileR)
EndIf
EndProcedure