Archive: Problem System plugin on win98


Problem System plugin on win98
I have a problem. I list scheduled tasks and GPF on win98. It works fine on win2k/xp.


!define GUIDTask "{148BD520-A2AB-11CE-B11F-00AA00530503}"
!define GUIDITask "{148BD524-A2AB-11CE-B11F-00AA00530503}"
!define GUIDTaskScheduler "{148BD52A-A2AB-11CE-B11F-00AA00530503}"
!define GUIDITaskScheduler "{148BD527-A2AB-11CE-B11F-00AA00530503}"
!define GUIDITaskTrigger "{148BD52B-A2AB-11CE-B11F-00AA00530503}"
!define GUIDIPersistFile "{0000010b-0000-0000-C000-000000000046}"

SetPluginUnload alwaysoff
System::Call "ole32::CoCreateInstance(g '${GUIDTaskScheduler}', i 0, i 11, g '${GUIDITaskScheduler}', *i .R1) i.R9"
IntCmp $R9 0 0 End
; ITaskScheduler->Enum(IEnumWorkItem)
System::Call '$R1->5(*i .R2) i.R9'
; IUnknown->Release()
System::Call '$R1->2() i' ; release Task Scheduler object
IntCmp $R9 0 0 End
ciklus0:
; read tasks
System::Call '$R2->3(i 5, *i .r3, *i .r4) i .r9'
; if no more task
IntCmp $4 0 folyt0
ciklus1:
System::Call '*$3(w .r8)'
; task name
DetailPrint "$8"
folyt1:
System::Call "ole32::CoTaskMemFree(i r8)"
IntOp $3 $3 + 4
Intop $4 $4 - 1
IntCmp $4 0 ciklus0
GoTo ciklus1

folyt0:
; IUnknown->Release()
System::Call '$R2->2() i' ; release Enum Work Item object

End:
; last plugin call must not have /NOUNLOAD so NSIS will be able to delete the temporary DLL
SetPluginUnload manual
; do nothing
System::Free 0


What is the wrog?
When I change
System::Call '*$3(w .r8)' -> System::Call '*$3(t .r8)'
than I get first letter of task.

Are you sure the task scheduler on 98 uses the same COM stuff as NT5? IIRC it first came out in the win95 plus pack, might not be the same codebase as the one used on NT


Yes, I sure. I try sample C++ program from MS, and works fine on Win9x/2k/XP.


offtopic: CoTaskMemFree(i r8) doesnt look right to me


The problem seems to be the way you handle the array returned by IEnumWorkItems::Next. You completely ignore the fact it's an array of string pointers and treat like a direct string pointer. You also free just the array and not all the strings in it as specified in MSDN.


OK, I understand you. But than how can I read names of scheduled tasks?


I solve the problem. :)
I wrote a plugin with this function.