unfortunately I'm trying to resolve an XP/2003 specific systems programming issue.
I'm trying to enumerate all scheduled tasks on XP/2003 systems and their associated properties (task creator, executable, path to executable, etc). The task scheduler API for this windows version is 1.0 and radically different from the 2.0 scheduler (for which I have already solved this problem but unfortunately support for XP is required still).
If you look here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa446831(v=vs.85).aspx
You will see it is fairly simple to iterate through all scheduled tasks and print them to screen using IEnumWorkItems and wprintf.
HOWEVER, my issue is that in order to retrieve properties for each task like I mentioned earlier, I need to pass a LPCWSTR variable of the task name into the ITaskScheduler->Activate method. See here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa381813(v=vs.85).aspx
So I can use IEnumWorkItems to get task names but it returns a LPWSTR value. I have tried using that and the application will compile but errors out when I run it. If I manually declare a LPCWSTR test =L"Name of Task"; then it runs fine and spits out my result. This is obviously not sufficient as I want the application to iterate the tasks dynamically.
So how do I pass the LPWSTR variable containing the name of the task over to my ITaskScheduler->Activate method when it needs LPCWSTR? I've tried converting stuff but it doesn't seem to work. I must be going about this the wrong way.
Aucun commentaire:
Enregistrer un commentaire