Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

how to STOP an Internet connection

Applications want to connect to internet by Dialup Modem almost use RASAPI32.DLL and RasDialA function.
How can I STOP an UNKNOWN connection BEFORE modem dialup ?

My Idea :
Hook function RasDialA in RASAPI32.DLL but unsuccessful because if a program was packed, it doesn't effect.

Who have an ideas ?
0
LeVuHoang
Asked:
LeVuHoang
2 Solutions
 
DaFoxCommented:
Hi,

>> Hook function RasDialA in RASAPI32.DLL but unsuccessful because if a program was packed, it doesn't effect.

Just hook LoadLibrary and/or GetProcAddress to get notified when a process loads RasDial API. Or patch the IAT of the *running* process.

Markus
0
 
saienlyhCommented:
function DisconnectActiveConnection: Boolean;

var

RasEntry: TRasEntry;

EntryInfoSize: Cardinal;

DeviceInfoSize: Cardinal;

RasGetEntryPropertiesResult: Integer;

begin

ZeroMemory(@RasEntry, SizeOf(TRasEntry));

RasEntry.dwSize := SizeOf(TRasEntry);

EntryInfoSize := SizeOf(TRasEntry);

RasGetEntryPropertiesResult := RasGetEntryProperties(nil,

MyActiveEntryName), @RasEntry, EntryInfoSize, nil, DeviceInfoSize);

if (RasGetEntryPropertiesResult = 0) then

Result := DisconnectDevice(StrPas(RasEntry.szDeviceName));

end;

 
0
 
LeVuHoangAuthor Commented:
thank you, but how to Hook LoadLibrary and disconnect BEFORE the connection finished
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now