A good discussion on how to do it and potential pitfalls in the implementation of a sudo clone on Win32 is available here. Although the examples are for Python, the system calls and pitfalls are all the same. If you can't get that link to work, try the Yahoo Cache of the page.