FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Harbour Error GPF., permiso para ejecutar binario
Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Harbour Error GPF., permiso para ejecutar binario
Posted: Mon Nov 05, 2018 11:25 PM

Saludos
Cuando instalo mi sistema en OS Windows 8, al arrancar generar error GPF y sale del sistema
Debo otorgarle permiso , accedo a explorador, Mi PC, Propiedades, configuracion avanzada del sistema, rendimiento, prevencion de ejecucion de datos "DEP", boton Agregar, debo indicar la ruta y nombre del programa.

Necesito una manera directa de asignar este permiso y evitarle al usuario realizar demasiados pasos.

Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Tue Nov 06, 2018 11:14 AM

Saludos a todos
Encontré esta funcionalidad, voy a probarla

http://freyes.svetlian.com/RunAs/RunAs.htm
runas /user:pippin /savecred miaplicacion.exe

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Tue Nov 06, 2018 11:55 AM
http://www.source-code.biz/snippets/c/1.htm

la función del API de Windows que proporciona esta funcionalidad es: CreateProcessWithLogonW()
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-createprocesswithlogonw

Code (fw): Select all Collapse
// miniRunAs  -  A minimalist "run as" for Windows (a runas.exe alternative)
//
// Home page: <!-- w --><a class="postlink" href="http://www.source-code.biz/snippets/c/1.htm">www.source-code.biz/snippets/c/1.htm</a><!-- w -->
// License: GNU/LGPL (<!-- w --><a class="postlink" href="http://www.gnu.org/licenses/lgpl.html">www.gnu.org/licenses/lgpl.html</a><!-- w -->)
// Copyright 2008 Christian d'Heureuse, Inventec Informatik AG, Switzerland.
// This software is provided "as is" without warranty of any kind.
//
// Version history:
// 2008-03-09 Christian d'Heureuse (<!-- e --><a href="mailto:chdh@inventec.ch">chdh@inventec.ch</a><!-- e -->)
//   Module created.
// 2011-07-05 Christian d'Heureuse (<!-- e --><a href="mailto:chdh@inventec.ch">chdh@inventec.ch</a><!-- e -->)
//   lpDomain parameter of CreateProcessWithLogonW changed from L"." to NULL.


#define UNICODE
#define _WIN32_WINNT 0x0500                                // Win2K and later
#include <stdio.h>
#include <Windows.h>

static const char*           programVersion = "2008-03-09";

static wchar_t               user[64];
static wchar_t               password[64];
static wchar_t               commandLine[1024];

static void displayHelp() {
   printf ("\n");
   printf ("miniRunAs  -  A minimalist \"run as\"\n");
   printf ("\n");
   printf ("Usage:   miniRunAs <user> <password> <commandline>\n");
   printf ("Example: miniRunAs administrator sesame ping localhost\n");
   printf ("Author:  Christian d'Heureuse, <!-- w --><a class="postlink" href="http://www.source-code.biz">www.source-code.biz</a><!-- w -->, <!-- e --><a href="mailto:chdh@inventec.ch">chdh@inventec.ch</a><!-- e -->\n");
   printf ("License: GNU/LGPL (<!-- w --><a class="postlink" href="http://www.gnu.org/licenses/lgpl.html">www.gnu.org/licenses/lgpl.html</a><!-- w -->)\n");
   printf ("Version: %s\n", programVersion); }

static void displayWin32ApiError (const char* routineName) {
   DWORD errorCode = GetLastError();
   wchar_t* msg = NULL;
   int i = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
         NULL, errorCode, 0, (LPWSTR)&msg, 0, NULL);
   if (i == 0) {
      fprintf (stderr, "FormatMessage failed for error code %i.\n", errorCode); return; }
   fwprintf (stderr, L"Error code %i returned from %S.\n%s\n", errorCode, routineName, msg);
   LocalFree (msg); }

static const wchar_t* skipBlanks (const wchar_t* s) {
   while (*s == L' ') s++;
   return s; }

static const wchar_t* skipNonBlanks (const wchar_t* s) {
   while (*s != 0 && *s != L' ') s++;
   return s; }

static const wchar_t* skipPastChar (const wchar_t* s, wchar_t c) {
   while (*s != 0) {
      if (*s == c) {s++; break; }
      s++; }
   return s; }

static const wchar_t* parseNextWord (const wchar_t* s, wchar_t* wBuf, int wBufSize) {
   const wchar_t* s1 = skipBlanks(s);
   const wchar_t* s2 = skipNonBlanks(s1);
   wcsncpy_s (wBuf, wBufSize, s1, s2-s1);
   return s2; }

static bool parseCommandLineParms() {
   const wchar_t* s = GetCommandLine();
   s = skipBlanks(s);
   if (*s == L'"')
      s = skipPastChar(s+1, L'"');                         // if the commandline starts with a quote, we have to skip past the next quote
    else
      s = skipNonBlanks(s);                                // otherwise the program path does not contain blanks and we skip to the next blank
   s = skipBlanks(s);
   if (*s == 0) {                                          // no command-line parameters
      displayHelp();
      return false; }
   s = parseNextWord(s, user, sizeof(user)/2);
   s = parseNextWord(s, password, sizeof(password)/2);
   s = skipBlanks(s);
   wcscpy_s (commandLine, s);
   if (commandLine[0] == 0) {
      fprintf (stderr, "Missing command-line arguments.\n");
      return false; }
   return true; }

int main() {
   if (!parseCommandLineParms()) return 9;
   STARTUPINFOW si;
   memset (&si, 0, sizeof(si));
   si.cb = sizeof(si);
   PROCESS_INFORMATION pi;
   BOOL ok = CreateProcessWithLogonW (
      user,
      NULL,                                                // change to L"." to use local account database only
      password,
      LOGON_WITH_PROFILE,
      NULL,
      commandLine,
      0,
      NULL,
      NULL,
      &si,
      &pi);
   if (ok == 0) {
      displayWin32ApiError ("CreateProcessWithLogonW");
      return 9; }
   return 0; }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Wed Nov 07, 2018 08:45 AM

Antonio
Saludos y Gracias,
Utilicé el comando
runas /user:administrator /savecred dpnmwin.exe
y aun persiste la incidencia, buscaré en el registro de windows lugar donde se almacena los binarios permisados.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Wed Nov 07, 2018 02:10 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Fri Nov 09, 2018 06:56 AM

Saludos y Gracias
El comando RUNAS.EXE no resuelve el permiso del binario.
Aun sigue generando el error GPF

Posts: 990
Joined: Wed Oct 19, 2005 02:17 PM
Re: Harbour Error GPF., permiso para ejecutar binario
Posted: Fri Nov 09, 2018 07:26 AM

Continue the discussion