Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

Georg Haan

@Georg Haan
About
Posts
28
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • It has been a privilege...
    G Georg Haan

    ...that's bugging me... I wrote a message about a CreateProcessAsUser problem a few hours ago titled "Is it a bird? ... No It's Superuser!". I've managed to narrow the problem, so it should be more easy to anwser... Given that I know the name of my administrator account and it's password, how can I get SeAssignPrimaryTokenPrivilege, operating from a regular account, in order to succesfully place a call to CreateProcessAsUser? The idea is to copy the functionality of Linux' su... Regards, Georg Haan(.NL)

    C / C++ / MFC question linux help

  • Is it a bird? Is it a plane? No! It's SuperUser
    G Georg Haan

    Again, thanks for your quick response... Andreas Saurwein wrote: Which is pretty strange as the current threads token just HAS to exist. Peculiar is another way of saying pretty strange... The peculiarity of the error is why I posted my message on CodeProject... Andreas Saurwein wrote: Exactly this may be a reason for failures. Sometimes functions may fails because you are requesting more than you are privileged to do. You are right. But the functions in which I request ALL_ACCESS do not generate an error, therefore I must be being granted full access... The trouble starts when some functions (CreateProcessAsUser, AdjustTokenPrivileges) imply I have too little access... Andreas Saurwein wrote: But, greedy as you are, you are asking for more. A friendly word of advice: Don't be too quick on judgements like that, nor too generous with such statements... Regards, Georg Haan(.NL)

    C / C++ / MFC linux debugging help question

  • Is it a bird? Is it a plane? No! It's SuperUser
    G Georg Haan

    Again, thanks for your comment too. I have tried the server.c you refer to already, it gives errors opening the threadtoken. A peculiar error that is, it says, "The specified token doesn't exist". The general problem can't be due to flags, because the ALL_ACCESS flag used, symbolizes complete access including all possible flags. I use it to be sure I don't miss one... Regards, Georg Haan(.NL)

    C / C++ / MFC linux debugging help question

  • Is it a bird? Is it a plane? No! It's SuperUser
    G Georg Haan

    Thanks for your comment, but there must be a way to use impersonation functions without upgrading to a (local) service? ImpersonateLoggedOnUser works fine by the way, and the RCMD example Mr. Saurwein refers (see next message) to doesn't upgrade itself to service neiter... Regards, Georg Haan(.NL)

    C / C++ / MFC linux debugging help question

  • Is it a bird? Is it a plane? No! It's SuperUser
    G Georg Haan

    I've been wrestling with this one for four days now. Time to ask the experts...
    I'm trying to run an application as Administrator... My app is supposed to have the functionality of Linux' SU...
    Im trying to do this with CreateProcessAsUser, which spits out error 1314, meaning something like "missing client privilige."
    I believe those privileges refer to those of the calling process, whose lacking SE_ASSIGNPRIMARYTOKEN_NAME privilege. When I try to assign that one, using a method that uses AdjustTokenPrivileges, that one spits out error 1300, "haven't assigned your privilege". Errors 1300 and 1314 are the only errors spit out.

    Some other notes:
    The assure method is a debug routine, it does not interfere anywhere...
    That's not really my admin password, mine is trice as long and quadruple complex
    Besides SetPrivilege and CreateProcessAsUser no functions called return an error...
    What's going wrong? What should I change? Comments, suggestions, questions and URL's are welcome...
    BTW, I've got working SU code using the largely undocumented CreateProcessWithLogon fucntion, but this one doesn't work in NT 4.0, which is where this code should work...

    The code:
    STARTUPINFO *si = (STARTUPINFO *)allocm(sizeof(STARTUPINFO)); PROCESS_INFORMATION *pi = (PROCESS_INFORMATION *)allocm(sizeof(PROCESS_INFORMATION)); si->cb = sizeof(STARTUPINFO); LogonUser( "Administrator", ".", "09nnj!ty&56t", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken ); assure("LogonUser"); OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS,&hToken2); assure("OpenProcessToken"); DuplicateTokenEx( hToken, TOKEN_ALL_ACCESS, NULL, SecurityImpersonation, TokenPrimary, &hToken3 ); assure("DuplicateToken"); ImpersonateLoggedOnUser(hToken3); assure("ImpersonateLoggedOnUser"); SetPrivilege(hToken2,SE_INCREASE_QUOTA_NAME,true); assure(SE_INCREASE_QUOTA_NAME); SetPrivilege(hToken2,SE_ASSIGNPRIMARYTOKEN_NAME,true); assure(SE_ASSIGNPRIMARYTOKEN_NAME); CreateProcessAsUser( hToken3, NULL, "Taskmgr", NULL, NULL, 0, CREATE_DEFAULT_ERROR_MODE | NORMAL_PRIORITY_CLASS, NULL, NULL, si, pi ); assure("CreateProcessAsUser"); Regards, Georg Haan (.NL)

    C / C++ / MFC linux debugging help question

  • Hidden
    G Georg Haan

    In my neverending struggle to eliminate all overhead, I recently chose to do without the default libraries in my application, resulting in the following errors: main.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler main.obj : error LNK2001: unresolved external symbol __except_list How do I get rid of them? What am I still using that needs these functions? And how on earth am I ever going to replace the recently thrown out *operator new in my application that I use every twenty lines? Regards, Georg-Hendrik Haan (.NL)

    C / C++ / MFC question help

  • netstat
    G Georg Haan

    Try this(NT only!): SysInternals OpenSource Tcpview http://www.sysinternals.com/ntw2k/source/tcpview.shtml Georg Haan (.NL)

    C / C++ / MFC question

  • WinMain hidden powers
    G Georg Haan

    Like most people here, I like small, compact and optimized code. Therefore I among other things, I ignore the default libraries when I can, and use a void main() instead of the default WinMain entrypoint. I was implemeting ADO as described here[^] in an app, which has such a void main() entry point. After successfully instantiating a ADODB.Connection object, I cannot use any of its functions normally. pConn->Open(...) causes an unknown exception, pConn->raw_Open(...) works fine. pConn->Execute(...) causes an unknown exception, pConn->raw_Execute(...) works fine. then after changing the void main to the standard WinMain, everything pConn 'behaves' normal. What is void main() lacking, what WinMain isn't? Georg Haan, NL

    C / C++ / MFC question database com

  • NT Expert needed
    G Georg Haan

    Hello there, is there a way to programmatically add user-accounts in NT? - YES! - How? And why aren't the lsa* functions like lsaopenpolicy and such documented (in MSDN)? (Where is it documented?) Georg Haan

    C / C++ / MFC question

  • How do l execute a program from within the code?
    G Georg Haan

    To keep the black window from popping up, try WinExec with the SW_HIDE flag. Even better would be to redirect output entirely, not to a file, but to a pipe. Nothing gets written to a drive this way... Microsoft has sample code for this, you'l find ithere. Georg Haan

    C / C++ / MFC adobe question

  • Puzzle2
    G Georg Haan

    *ssh*l*

    The Lounge question

  • srand()
    G Georg Haan

    srand delivers a number between 0 and to break it down to a number 1 - 20 you must modulate it. the operator for that is % better explained: 4 % 3 = 1 '%3' means as much as 'deduct 3 until I have a number less than 3' 0%3=0 1%3=1 2%3=2 3%3=0 4%3=1 5%3=2 6%3=0 etc. srand()%20 will give you a number between 0 and 20. to get a number between 1 and 20 use this: (srand()%19)+1 BTW, a few months back I saw a CMersenneTwister class here on the codeproject. You might want to take a look at it, it's a better random number generator... Georg Haan (.NL)

    C / C++ / MFC question tutorial lounge

  • Can anybody explan the function TransparentBlt()?
    G Georg Haan

    TransparentBlt can be used to paint a picture from one DC (the source) to another (the destination). The special thing about it is, that you can designate a specific color to be transparent. Any pixel on the source DC with that specific color, will not be copied. It purpose was to supersede older BitBlt hassle with masks. if you have a DC ready with an image you want to place on a windowDC, and this image has the color black designated as transparent, this code would probably work: In your message handler: case WM_PAINT: TransparentBlt( (HDC) wParam, // your window DC 0, // Dest. x 0, // Dest. y 220, // width of picture on destination 440, // height of picture on destination hdcSrc, // Source DC 0, // Source x 0, // Source y 220, // width of picture on source 440, // height of picture on source RGB(0,0,0) // Macro, specifies the color black ); if source and destination heights and widths differ, TranparentBlt stretches the source image to fit the size specified for the destination... If you need more help concerning this, you could, if you like, email me the piece of source you're having trouble with... Georg Haan (.Netherlands)

    C / C++ / MFC tutorial question

  • AAAAAAAAAAAAAAAARGH!
    G Georg Haan

    For the real guru: How can I - if at all possible - instantiate a Web Browser Control in a window, not using MFC? I'd really appreciate something in the form of CreateWindow("Class_Webbrowser", ... but I have a faint feeling that's not all there's to it... Comments please! Georg Haan (.NETherlands)

    C / C++ / MFC question csharp c++

  • Sonork?
    G Georg Haan
    The Lounge question

  • Sonork?
    G Georg Haan

    I'm not going to gratify that with a message. At least I wasnt planning to do it until i started typing this.

    The Lounge question

  • Sonork?
    G Georg Haan

    What on earth is a pommie bastard? Are those the persons that do have a girlfriend? Was I just insulted? Georg Haan (.NL)

    The Lounge question

  • Cantaro sim -quabala !
    G Georg Haan

    &;

    C / C++ / MFC question

  • Sonork?
    G Georg Haan

    except for the horrible security bugs in it I recently shamelessly exploited to get information from a certain friend he didn't want me to know? No! I'm not braggging! What places Sonork above Pagoo ICQ and Messenger? Tell me TELL ME T E L L M E !

    The Lounge question

  • Sonork?
    G Georg Haan

    on earth is cat's pi*s?

    The Lounge question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups