In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

Que significa implicit declaration of function 'LockWorkStation'

Foro de Xailer profesional en español
Responder
Bingen Ugaldebere
Mensajes: 1310
Registrado: Mié Sep 26, 2007 7:12 pm

Que significa implicit declaration of function 'LockWorkStation'

Mensaje por Bingen Ugaldebere »

Buenos dí­as XTeam
Estaba intentando hacer una función de C muy simple y no lo consigo
#pragma BEGINDUMP
#include "Windows.h"
#include "Xailer.h"
#include "stdio.h"
XA_FUNC( LOCKPC )
{
hb_retl( LockWorkStation() );
}
#pragma ENDDUMP
El compilador me da de todas todas:
warning: implicit declaration of function 'LockWorkStation'
[-Wimplicit-function-declaration]
Muchas Gracias.
joselalinf
Mensajes: 291
Registrado: Jue Ene 31, 2013 1:10 pm

Que significa implicit declaration of function 'LockWorkStation'

Mensaje por joselalinf »

Bingen,
significa que no encuentra el prototipo de la función. Hazlo así­:
> #pragma BEGINDUMP
#define _WIN32_WINNT 0x0500
> #include "Windows.h"
> #include "Xailer.h"
> #include "stdio.h"
Este puedes quitarlo.
Saludos,
José Lalí­n
Bingen Ugaldebere
Mensajes: 1310
Registrado: Mié Sep 26, 2007 7:12 pm

Que significa implicit declaration of function 'LockWorkStation'

Mensaje por Bingen Ugaldebere »

Gracias José pero además de esto tiene que ser el primero de los #pragma
BEGINDUMP del PRG para que funcione por que estaba el tercero y seguí­a
dando el mismo error.
//---------------------------------------------------------- --------------------
//Bloquea la estacion de trabajo
#pragma BEGINDUMP //Tiene que ser el primer #pragma
BEGINDUMP del prg para que funcione
#define _WIN32_WINNT 0x0500
#include "Windows.h"
#include "Xailer.h"
XA_FUNC( LOCKPC )
{
hb_retl( LockWorkStation() );
}
#pragma ENDDUMP
//---------------------------------------------------------- --------------------
//ShutDownPC apaga el PC cerrandolo todo, ojo lo que no está grabado se
pierde
#pragma BEGINDUMP
#include "Windows.h"
#include "Xailer.h"
XA_FUNC( SHUTDOWNPC )
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if( OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY, &hToken ) ){
LookupPrivilegeValue( NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid );
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges( hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0 );
if( GetLastError() == ERROR_SUCCESS ){
InitiateSystemShutdown( NULL, NULL, 0, TRUE, FALSE );
}
}
}
#pragma ENDDUMP
//---------------------------------------------------------- --------------------
//RebootPC resetea el PC cerrandolo todo, ojo lo que no está grabado se
pierde
#pragma BEGINDUMP
#include "Windows.h"
#include "Xailer.h"
XA_FUNC( REBOOTPC )
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if( OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY, &hToken ) ){
LookupPrivilegeValue( NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid );
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges( hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0 );
if( GetLastError() == ERROR_SUCCESS ){
InitiateSystemShutdown( NULL, NULL, 0, TRUE, TRUE );
}
}
}
#pragma ENDDUMP
//---------------------------------------------------------- --------------------
joselalinf
Mensajes: 291
Registrado: Jue Ene 31, 2013 1:10 pm

Que significa implicit declaration of function 'LockWorkStation'

Mensaje por joselalinf »

Bingen,
> Gracias José pero además de esto tiene que ser el primero de los #pragma
> BEGINDUMP del PRG para que funcione por que estaba el tercero y seguí­a
> dando el mismo error.
entonces pon las tres funciones en el mismo bloque ;-)
Saludos,
José Lalí­n
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5706
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

Que significa implicit declaration of function 'LockWorkStation'

Mensaje por jfgimenez »

Bingen,
> Gracias José pero además de esto tiene que ser el primero de los
> #pragma BEGINDUMP del PRG para que funcione por que estaba el tercero
> y seguí­a dando el mismo error.
>
> //---------------------------------------------------------- --------------------
>
> //Bloquea la estacion de trabajo
> #pragma BEGINDUMP //Tiene que ser el primer #pragma
> BEGINDUMP del prg para que funcione
> #define _WIN32_WINNT 0x0500
> #include "Windows.h"
> #include "Xailer.h"
no es por que sea el primero o el último, es porque ese #define tiene
que estar siempre *antes* del #incude "windows.h". Una vez que se ha
procesado windows.h, ya da igual lo que pongas porque no va a hacer ni caso.
Un saludo,
José F. Giménez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder