Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-08-2016
neomicho85 neomicho85 is offline
Registrado
NULL
 
Registrado: ago 2016
Posts: 4
Poder: 0
neomicho85 Va por buen camino
CreateProcessWithLogonW

Hola amigos del foro, estoy trabajando en una app que necesita CreateProcessWithLogonW estoy trabajando en MicrosoftVisual C++ pero me esta dando el siguiente problem: error C2065: 'CreateProcessWithLogonW' : undeclared identifier. El codigo que estoy utilizando es basado en Microsoft

Código:
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <sstream>
#include <fstream>
#include <stdlib.h>
#include <windows.h>
#include <userenv.h>
#define _WIN32_WINNT 0x0500
const LOGON_WITH_PROFILE = 0x00000001;


void wmain(int argc, WCHAR *argv[])
{
    DWORD     dwSize;
    HANDLE    hToken;
    LPVOID    lpvEnv;
    PROCESS_INFORMATION pi = {0};
    STARTUPINFO         si = {0};
    WCHAR               szUserProfile[256] = L"";

    si.cb = sizeof(STARTUPINFO);
    
    if (argc != 4)
    {
        wprintf(L"Usage: %s [user@domain] [password] [cmd]", argv[0]);
        wprintf(L"\n\n");
        return;
    }

    //
    // TO DO: change NULL to '.' to use local account database
    //
    if (!LogonUser(argv[1], NULL, argv[2], LOGON32_LOGON_INTERACTIVE, 
            LOGON32_PROVIDER_DEFAULT, &hToken))
       return 1;

    if (!CreateEnvironmentBlock(&lpvEnv, hToken, TRUE))
     return 1;

    dwSize = sizeof(szUserProfile)/sizeof(WCHAR);

    if (!GetUserProfileDirectory(hToken, szUserProfile, &dwSize))
        return 1;

    //
    // TO DO: change NULL to '.' to use local account database
    //
    if (!CreateProcessWithLogonW(argv[1], NULL, argv[2], 
            LOGON_WITH_PROFILE, NULL, argv[3], 
            CREATE_UNICODE_ENVIRONMENT, lpvEnv, szUserProfile, 
            &si, &pi))
        return 1;

    if (!DestroyEnvironmentBlock(lpvEnv))
        return 1;

    CloseHandle(hToken);
    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
}

Última edición por dec fecha: 02-08-2016 a las 19:13:49. Razón: Añadir etiqueta CODE
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
En que unit esta CreateProcessWithLogonW JoAnCa API de Windows 2 08-04-2009 01:35:09


La franja horaria es GMT +2. Ahora son las 00:22:23.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi