WntOwner errors out in 64bit

Started by jat6923, September 03, 2013, 07:27:14 AM

Previous topic - Next topic

jat6923

Trying to check/reset ownership on a folder on a Win7 64bit system to the local Administrators group.  The following code works fine when compiled as 32bit, but causes Winbatch to stop working in 64bit.  When run in 64bit debuger, get message Winbatch Studio 64-bit debugger has stopped working and closes app.

Addextender("wwwnt64i.dll")
Errormode(@off)
owner = wntOwnerGet("", 0, "c:\humscript", 300, 0)
If owner <> "Administrators" then
    st = wntOwnerSet("", 0, "c:\humscript", 300, "Administrators", 2)
endif
q = wntAccessAdd("","c:\humscript","USERS",300,"Dir2K:Modify")  ;specify user group rights to modify
errormode(@cancel)


Any suggestions?

td

There are two mystery here. One is why you got your script to work with the 32-bit extender as the problem can easily be duplicated with both the 32-bit and 64-bit extenders.  In fact, it appears the problem was  around long before the extender was ported to 64-bit.  The second mystery is why no one has run across it before now.

Hopefully, we will be able to find a resolution to the issue for the next version of the extender.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Deana

Tony,

I am able to get the following to work using the 32bit extender on Windows 7 64-bit:

Code (winbatch) Select

Addextender("wwwnt34i.dll")
owner = wntOwnerGet("", 0, "c:\humscript", 300, 0)


however the 64-bit extender crashes:

Code (winbatch) Select

Addextender("wwwnt64i.dll")
owner = wntOwnerGet("", 0, "c:\humscript", 300, 0)
Deana F.
Technical Support
Wilson WindowWare Inc.

td

Like I said, I can get it to crash with either the 32-bit or 64-bit extender. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jat6923

Does anyone have a suggested work around in the meantime, till the function is fixed?

Deana

Quote from: jat6923 on September 03, 2013, 10:51:14 AM
Does anyone have a suggested work around in the meantime, till the function is fixed?

Not sure. Have you considered using WMI?  The TakeOwnership method looks interesting: http://msdn.microsoft.com/en-us/library/windows/desktop/aa393903(v=vs.85).aspx

Code (winbatch) Select
;Trying to check/reset ownership on a folder on a Win7 64bit system to the local Administrators group.
Addextender("wwwnt64i.dll")

strComputer = "."
objWMIService = GetObject("winmgmts:\\" : strComputer : "\root\CIMV2")
objShare = objWMIService.Get("Win32_Directory")
objOutParams = objWMIService.ExecMethod("Win32_Directory.Name='c:\humscript'", "TakeOwnerShip")
result = objOutParams.ReturnValue

before = wntAccessGet("","c:\humscript","USERS",300)
q = wntAccessAdd("","c:\humscript","USERS",300,"Dir2K:Modify")  ;specify user group rights to modify
after = wntAccessGet("","c:\humscript","USERS",300)

Pause('Results','Before = ':before:@lf:'After = ':after)
Deana F.
Technical Support
Wilson WindowWare Inc.

td

Since you are having success with the 32-bit extender, you could continue to use it.  Although given the nature of this beast there is no guarantee the 32-bit version wont crash on you in some pseudo-random fashion down the road. 

You could also experiment with driving the calcs.exe and takeown.exe command line utilities with WinBatch.  I am not sure if there are any example in the tech db but it might be worth a look.

We will certainly make every effort to get this fixed and posted to the download page as soon as possible.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jat6923

thanks for the help.  The Takeown utility worked for now.   Will be looking for the fix for the extender function.