June 15, 2024, 11:51:18 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Stop a process

Started by Andy, March 27, 2012, 01:44:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

My project has now been ported over to IWB with one exception - one program which stops explorer.exe.

Copex posted and example which I modified slightly to run in EB and it works, but I cannot compile this in IWB.

Can anyone help?

The error messages are:

Compiling...
IWBASIC1.iwb
File: C:\KMS\Browser2\IWBASIC1.iwb (236) Error: Privileges is not a member of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (219) Warning: See declaration of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (238) Error: bEnablePrivilege is not a member of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (219) Warning: See declaration of TOKEN_PRIVILEGES
Error(s) in compiling C:\KMS\Browser2\IWBASIC1.iwb


Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

pistol350

The code compiles and works fine for me with Ebasic 1.735
Maybe your version of Sapero Windows header Pak is not up to date.
Regards,

Peter B.

Andy

Hi Pistol,

I'm trying to compile it now in IWB not EB - it works fine in EB

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

The error messages show you what the problem is:
QuoteFile: C:\KMS\Browser2\IWBASIC1.iwb (236) Error: Privileges is not a member of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (219) Warning: See declaration of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (238) Error: bEnablePrivilege is not a member of TOKEN_PRIVILEGES
File: C:\KMS\Browser2\IWBASIC1.iwb (219) Warning: See declaration of TOKEN_PRIVILEGES

The two error lines in your code are:
tp.Privileges[0].Luid = luidand    if bEnablePrivilege = true
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED
else
tp.Privileges[0].Attributes = 0
ENDIF

The error messages are telling us the above code and the TYPE declaration for TOKEN_PRIVILEGES don't match.

If we look where tp is defined we see:def tp:TOKEN_PRIVILEGES
So we look at TOKEN_PRIVILEGES:TYPE TOKEN_PRIVILEGES
DEF PrivilegeCount:INT
DEF LowPart:INT
DEF HighPart:INT
DEF Attributes:INT
ENDTYPE

It's easy to see that there is no Privileges element which results in the indicated error messages when you try to compile in IWB.

The real mystery is why it will compile in EB and not IWB.
First, for it to be compiling in EB it would mean that somehow TOKEN_PRIVILEGES is getting defined with a Privileges element.

So I searched the include folder and found another TYPE statement for TOKEN_PRIVILEGES.
I then commented out the TYPE at line 219 and relied on the existing one in the include folder.
It compiled fine and the program ran as expected.

So why did it work in EB and not in IWB?
Notice where the TYPE declaration is located in the code.  It is inside of a subroutine which makes it local to the sub and is properly overriding the definition external to the sub.  Apparently, in EB, it didn't handle that situation properly and just ignored the definition inside the sub.

And that's my story and I'm sticking to it! ;D

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Thank you so much!  :)

Yes the clue was TOKEN_PRIVILEGES - I tried everything I could think of except relying on the previous declaration in the include file.

So as you said I have commented out TOKEN_PRIVILEGES in the code and it works great!!

Hats off to you  ;D

Thanks again,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

pistol350

Yep!
I can tell that Larry went very deep into the problem  :)
Regards,

Peter B.