Author Topic: WntOwner errors out in 64bit  (Read 4492 times)

jat6923

  • Newbie
  • *
  • Posts: 7
WntOwner errors out in 64bit
« on: September 03, 2013, 07:27:14 am »
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

  • Tech Support
  • *****
  • Posts: 3490
    • WinBatch
Re: WntOwner errors out in 64bit
« Reply #1 on: September 03, 2013, 10:22:28 am »
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

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: WntOwner errors out in 64bit
« Reply #2 on: September 03, 2013, 10:27:41 am »
Tony,

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

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

however the 64-bit extender crashes:

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

td

  • Tech Support
  • *****
  • Posts: 3490
    • WinBatch
Re: WntOwner errors out in 64bit
« Reply #3 on: September 03, 2013, 10:33:35 am »
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

  • Newbie
  • *
  • Posts: 7
Re: WntOwner errors out in 64bit
« Reply #4 on: September 03, 2013, 10:51:14 am »
Does anyone have a suggested work around in the meantime, till the function is fixed?

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: WntOwner errors out in 64bit
« Reply #5 on: September 03, 2013, 11:16:52 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
;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

  • Tech Support
  • *****
  • Posts: 3490
    • WinBatch
Re: WntOwner errors out in 64bit
« Reply #6 on: September 03, 2013, 11:25:16 am »
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

  • Newbie
  • *
  • Posts: 7
Re: WntOwner errors out in 64bit
« Reply #7 on: September 04, 2013, 07:03:15 am »
thanks for the help.  The Takeown utility worked for now.   Will be looking for the fix for the extender function.