Vista und SetTcpEntry
-
Ich bin hier wieder mal am verzweifeln

Es geht darum, mein Programm nach Vista zu porten.
Mein Programm kann und soll blacklisted Ip's blocken.
Um eine bestehende Verbindung zu terminieren (TCP) benutze
ich SetTcpEntryStreng nach Vorbild von MS:
... // Make a second call to GetTcpTable to get // the actual data we require DWORD dwRez = 999; dwRetVal = GetTcpTable(pTcpTable, &dwSize, TRUE); if (dwRetVal == NO_ERROR) { MIB_TCPROW sKillConn; for (i = 0; i < (int) pTcpTable->dwNumEntries; i++) { if( pTcpTable->table[i].dwRemoteAddr == attackerIp ) { sKillConn.dwLocalAddr = pTcpTable->table[i].dwLocalAddr; sKillConn.dwLocalPort = pTcpTable->table[i].dwLocalPort; sKillConn.dwRemoteAddr = pTcpTable->table[i].dwRemoteAddr; sKillConn.dwRemotePort = pTcpTable->table[i].dwRemotePort; sKillConn.dwState = MIB_TCP_STATE_DELETE_TCB; dwRez = SetTcpEntry(&sKillConn); } } } return dwRez;Ich setze dwRez vorher zu 999 um zu testen ob es beschrieben wird, und es wird beschrieben und zwar mit "0x13D" => "317"
Eigentlich sollte es 0 zurückgebenThe function returns NO_ERROR (zero) if the function is successful.
Return Value finde ich nicht aber es scheint hierdran zu liegen:
On Windows Vista or Windows Server 2008, the SetTcpEntry function can only be called by a user logged on as a member of the Administrators group. If SetTcpEntry is called by a user that is not a member of the Administrators group, the function call will fail and ERROR_ACCESS_DENIED is returned. This function can also fail because of user account control (UAC) on Windows Vista and Windows Server 2008. If an application that contains this function is executed by a user logged on as a member of the Administrators group other than the built-in Administrator, this call will fail unless the application has been marked in the manifest file with a requestedExecutionLevel set to requireAdministrator. If the application on Windows Vista or Windows Server 2008 lacks this manifest file, a user logged on as a member of the Administrators group other than the built-in Administrator must then be executing the application in an enhanced shell as the built-in Administrator (RunAs administrator) for this function to succeed.
Aber Access Denied gibt es nicht zurück.
GetLastError gibt 0 (=> ERROR_SUCCESS) zurück.Auf Windows XP funktioniert alles wunderbar, aber auf Vista macht er es nicht.
requestedExecutionLevel kann ich im Manifest nicht ändern, weil sich meine "Mini-Firewall" ein Hook ist und Verbindungen in laufenden Programmen terminiert. An der Architektur möchte ich auch nichts ändern.Vielleicht gibt es einen einfacheren Weg eine TCP Verbindung mit bekannter IP ins jenseits zu befördern? Oder einen anderen Lösungsvorschlag von euch?
Kann ja nicht sein das **** Vista so rumspacktmfG
euer Listing
-
Ich frage anders:
Wie kann ich einen laufenden Prozess mit UAC authentifizieren?
Oder: Wie kann ich einen bestimmten Prozess in UAC als Administrator-Prozess vormerken (Notepad.exe <- Always Administrator access)mfG
-
Du musst der EXE ein Manifest mitgeben. Es gibt u.a. die Möglichkeiten:
- asInvoker
- requireAdministratorDue suchst das letztere...
http://www.c-plusplus.net/forum/viewtopic-var-t-is-167580.html
-
Nagut, jetzt mache ich das in meiner gui mit requireAdministrator.
Ich muss jetzt aber von einer dll die keinen Administrator Acess hat und
in einem anderen Programm geladen ist, mit meinem GUI iergendwie kommunizieren.Normal würde ich SendMessage benutzen aber da zieht mir Microsoft einen Strich durch meine Rechnung:
Microsoft Windows Vista and later. Message sending is subject to User Interface Privilege Isolation (UIPI). The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.
Wie kann ich IPC (interprocess-communication) auf Vista als asInvoker betreiben?
Danke!!!