undefined reference RegisterSeviceCtrlHandlerA@8
Übersicht
BlitzMax, BlitzMax NG
Allgemein
andre72Betreff: undefined reference RegisterSeviceCtrlHandlerA@8 |
Antworten mit Zitat |
|
|---|---|---|
|
Hallo Zusammen,
ich bekomme es einfach nicht hin, die Funktion RegisterSeviceCtrlHandlerA@8 zu mutzen. Der Linker steigt immer mit der Meldung aus, dass es sich um eine undefined reference handelt. Vielleicht könnt Ihr mal probieren, ob Ihr den Beispiel-Source compilieren könnt. Wenn ja wäre ich dann dankbar, wenn mir jemand sagt, wie auch ich das anstellen kann Ob der Code funktioniert weiß ich nicht - mir geht es erstmal nur darum ihn zu kompilieren um dieses zu testen ... Danke, Andre Code: [AUSKLAPPEN] SuperStrict
Import "-ladvapi32" 'API Constants Const SERVICES_ACTIVE_DATABASE:String = "ServicesActive" ' Service Control Const SERVICE_CONTROL_STOP:Int = $1 Const SERVICE_CONTROL_PAUSE:Int = $2 ' Service State - for CurrentState Const SERVICE_STOPPED:Int = $1 Const SERVICE_START_PENDING:Int = $2 Const SERVICE_STOP_PENDING:Int = $3 Const SERVICE_RUNNING:Int = $4 Const SERVICE_CONTINUE_PENDING:Int = $5 Const SERVICE_PAUSE_PENDING:Int = $6 Const SERVICE_PAUSED:Int = $7 Const SERVICE_ACCEPT_STOP:Int = $1 Const SERVICE_ACCEPT_PAUSE_CONTINUE:Int = $2 Const SERVICE_ACCEPT_SHUTDOWN:Int = $4 'Service Control Manager object specific access types Const STANDARD_RIGHTS_REQUIRED:Int = $F0000 Const SC_MANAGER_CONNECT:Int = $1 Const SC_MANAGER_CREATE_SERVICE:Int = $2 Const SC_MANAGER_ENUMERATE_SERVICE:Int = $4 Const SC_MANAGER_LOCK:Int = $8 Const SC_MANAGER_QUERY_LOCK_STATUS:Int = $10 Const SC_MANAGER_MODIFY_BOOT_CONFIG:Int = $20 Const SC_MANAGER_ALL_ACCESS:Int = $F003F 'STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK or SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG 'Service object specific access types Const SERVICE_QUERY_CONFIG:Int = $1 Const SERVICE_CHANGE_CONFIG:Int = $2 Const SERVICE_QUERY_STATUS:Int = $4 Const SERVICE_ENUMERATE_DEPENDENTS:Int = $8 Const SERVICE_START:Int = $10 Const SERVICE_STOP:Int = $20 Const SERVICE_PAUSE_CONTINUE:Int = $40 Const SERVICE_INTERROGATE:Int = $80 Const SERVICE_USER_DEFINED_CONTROL:Int = $100 Const SERVICE_ALL_ACCESS:Int = $1FF 'STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL ' Service Install - Types Const SERVICE_WIN32_OWN_PROCESS:Int = $10 Const SERVICE_ERROR_NORMAL:Int = $1 Const SERVICE_AUTO_START:Int = $2 Const SERVICE_DEMAND_START:Int = $3 ' Service Types Const SERVICE_WIN32_SHARE_PROCESS:Int = $20 Const SERVICE_WIN32:Int = $30 Type SERVICE_STATUS Field dwServiceType:Int Field dwCurrentState:Int Field dwControlsAccepted:Int Field dwWin32ExitCode:Int Field dwServiceSpecificExitCode:Int Field dwCheckPoint:Int Field dwWaitHint:Int End Type Type SERVICE_TABLE_ENTRY Field lpServiceName:String Field lpServiceProc:Int End Type Extern "Win32" Function CloseServiceHandle:Int (hSCObject:Int) = "CloseServiceHandle@4" Function ControlService:Int (hService:Int, dwControl:Int, lpServiceStatus:Byte ptr) = "ControlService@12" Function OpenSCManager:Int (lpMachineName:Byte Ptr, lpDatabaseName:Byte Ptr, dwDesiredAccess:Int) = "OpenSCManagerA@12" Function OpenService:Int (hSCManager:Int, lpServiceName:Byte Ptr, dwDesiredAccess:Int) = "OpenServiceA@12" Function QueryServiceStatus (hService:Int, lpServiceStatus:Byte ptr) = "QueryServiceStatus@8" Function StartService:Int (hService:Int, dwNumServiceArgs:Int, lpServiceArgVectors:Int) = "StartServiceA@12" Function CreateService:Int (hSCManager:Int, lpServiceName:Byte ptr, lpDisplayName:Byte ptr, dwDesiredAccess:Int, dwServiceType:Int, dwStartType:Int, dwErrorControl:Int, lpBinaryPathName:Byte ptr, lpLoadOrderGroup:Byte ptr, lpdwTagID:Int, lpDependencies:Byte ptr, lp:Byte ptr, lpPassword:Byte ptr) = "CreateServiceA@52" Function StartServiceCtrlDispatcher:Int (lpServiceStartTable:Byte ptr) = "StartServiceCtrlDispatcherA@4" Function RegisterSeviceCtrlHandler:Int(lpServiceName:Byte ptr, lpHandlerProc:Byte ptr) = "RegisterSeviceCtrlHandlerA@8" End Extern Function ServiceCreate:Int(ServiceName:String) Local hSManager:Int = OpenSCManager(Null, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS) Local res:Int If hSManager <> 0 Local schService:Int = CreateService(hSManager, ServiceName, ServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, AppFile, Null, Null, Null, Null, Null) DebugLog(schService) If schService <> 0 CloseServiceHandle schService Endif CloseServiceHandle hSManager EndIf Return res End Function ServiceCreate "TestService" Local svc:SERVICE_TABLE_ENTRY New SERVICE_TABLE_ENTRY svc.lpServiceName = "MyProc" svc.lpServiceProc = SvcMain() Function SvcMain (argc:Int = Null, argv:String = "") Local svcStatus:SERVICE_STATUS = New SERVICE_STATUS svcStatus.dwServiceType = SERVICE_WIN32 svcstatus.dwCurrentState = SERVICE_START_PENDING svcstatus.dwControlsAccepted = $7 svcstatus.dwServiceSpecificExitCode = 0 svcstatus.dwCheckPoint = 0 svcstatus.dwWin32ExitCode = 0 svcstatus.dwWaitHint = 0 Local svchandle:Int = RegisterSeviceCtrlHandler("TestService", svcCtrlHandler) DebugLog("svchandle: " + svchandle) End Function Function svcCtrlHandler(dwOpcode:Int = Null) End Function |
||
klepto2 |
Antworten mit Zitat |
|
|---|---|---|
|
Du hast 2 Fehler in deinem Code, wobei dich der 1. wohl selbst am meisten ärgern wird:
es heißt RegisterServiceCtrlHandlerA@8 und nicht RegisterSeviceCtrlHandlerA@8. Dazu kommt noch : Local svc:SERVICE_TABLE_ENTRY=New SERVICE_TABLE_ENTRY |
||
|
Matrix Screensaver
Console Modul für BlitzMax KLPacker Modul für BlitzMax HomePage : http://www.brsoftware.de.vu |
||
andre72 |
Antworten mit Zitat |
|
|---|---|---|
|
Wie kommst Du den darauf, dass mich das ärgern wird ... Ist schon ehr peinlich, ich erzähl besser keinem wie lange ich daran schon rum stricke Na besten Dank für den Hinweis, dann kann es jetzt weiter gehen ... |
||
|
|
d-bug |
Antworten mit Zitat |
|---|---|---|
|
@andre72
Tust du uns den gefallen und verwendest das nächste mal die Code-Tags? Habs jetzt mal rein editiert, aber denk zukünftig daran, ja?! cheers |
||
Übersicht
BlitzMax, BlitzMax NG
Allgemein
Powered by phpBB © 2001 - 2006, phpBB Group
