1

I am Executing Hadoop Command using winutils.exe task create ip ipconfig from cmd with Admin privileges its work and shows the result. But if am trying the same in c# program with Admin privileges it shows Access is denied error.

Error :

C:Hadoop\bin>winutils.exe task create ip ipconfig

createTask error (5): Access is denied.
Suresh Ram
  • 1,034
  • 3
  • 16
  • 40

1 Answers1

0

The problem is with the WinUtils.exe. WinUtils.exe used AssignProcessToJobObject() in the createTask() method in task.c file.

In windows 7, If the Jobobject has already a process assigned, then ‘AssignProcessToJobObject’ cannot assign a new process and returns with ‘Access Denied’ message.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681949(v=vs.85).aspx So when you called the exe programatically, the jobObject may be already assigned with a ProcessHandle which then returns as "Access Denied" from the 'AssignProcessToJobObject' function.

Fix: Check the JobObject for any associated processes and assign a new process only if the jobObject is not assigned to any. Ensure your changes apply only to the Windows 7 environment and let the default code to be used in the Windows 8 and greater environments.

Hope this helps.

Kalai
  • 319
  • 1
  • 4
  • 21
  • Hi @MarHserus can you show me how to check the JobObject as Kalai mention above? Can I have your modified version of task.c file? Thanks – kholis Nov 05 '14 at 10:42
  • MarHserus: here is my modified version of task.c https://gist.github.com/kholis/5b6f3bcbe36819bf03c5/revisions. It can compiled but got error while it running. @Kalai: need help. Thanks – kholis Nov 05 '14 at 11:26