I wanted to create a list of installed printers.
Up to PB 6.04 with ASM and C backend it worded fine with the following code.
But with 6.10 beta 6 it crashs with both backends in line 15 with the PeekS / PeekL function
WIN 10 X64
Code: Select all
NewList Printers.s()
ClearList(Printers())
enumFlags = #PRINTER_ENUM_LOCAL | #PRINTER_ENUM_CONNECTIONS
If EnumPrinters_(enumFlags, #Null, 1, 0, 0, @deviceNamesBufferSize, @printerCount) = 0
deviceNamesBuffer = AllocateMemory(deviceNamesBufferSize)
If deviceNamesBuffer And EnumPrinters_(enumFlags, #Null, 1, deviceNamesBuffer, deviceNamesBufferSize, @sizeRDB, @printerCount)
If printerCount
pInfoNameOffset = OffsetOf(PRINTER_INFO_1\pName)
For i = 0 To (printerCount - 1)
AddElement(Printers())
Debug deviceNamesBuffer + i * (SizeOf(PRINTER_INFO_1)) + pInfoNameOffset
Printers() = PeekS(PeekL(deviceNamesBuffer + i * (SizeOf(PRINTER_INFO_1)) + pInfoNameOffset))
Debug Printers()
Next
EndIf
FreeMemory(deviceNamesBuffer)
EndIf
EndIf
NicknameFJ