Hi. I'm coding this cab file extracting utility which doesn't work. You'll see a strange function, CabExtract(), which calls a library I've coded for this little app. The program is supposed to list the files in the cab, but it doesn't. Can anybody tell me if something is wrong with the PB code? Otherwise, the library is to blame (if someone wishes to take a look at the asm source of the library, I'll send it). Thanks.
Code: Select all
InitGadget(3)
If CreateMenu(0)
MenuTitle("&File")
MenuItem(0, "&Open")
MenuItem(1, "&Extract")
MenuBar()
MenuItem(2, "&Quit")
EndIf
MenuHeight = 56
If OpenWindow(1,#CW_USEDEFAULT,#CW_USEDEFAULT,#CW_USEDEFAULT,#CW_USEDEFAULT,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget,"CAB Extract")
AttachMenu(0, WindowID())
If CreateGadgetList(WindowID())
ListIconGadget(0, 0, 0, WindowWidth(), WindowHeight(), "File", WindowWidth()/4)
AddGadgetColumn(0, 1, "Size", WindowWidth()/4)
AddGadgetColumn(0, 2, "Modified", WindowWidth()/4)
AddGadgetColumn(0, 2, "Path", WindowWidth()/4)
EndIf
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventMenu
Select EventMenuID()
Case 0 ; Open
file.s = OpenFileRequester("Open cabinet file","","Cabinet files (*.cab)|*.cab", 0)
If file""
ClearGadgetItemList(0)
bufferpointer = AllocateMemory(0, 16384, 0)
CabExtract(file, 1, bufferpointer)
While bufferpointer ""
CabExtract(file, 0, 0)
EndIf
Case 2 ; Close
Quit = 1
EndSelect
Case #PB_EventCloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
End
El_Choni