[DHCPCSVC] Remove obsolete functions

DhcpLeaseIpAddress, DhcpReleaseIpAddressLease and DhcpRenewIpAddressLease have been replaced by DhcpAcquireParameters and DhcpReleaseParameters
This commit is contained in:
Eric Kohl 2025-08-03 14:14:18 +02:00
parent 33696393e7
commit a6d3787507
7 changed files with 3 additions and 210 deletions

View file

@ -131,39 +131,6 @@ done:
return Send(CommPipe, &Reply);
}
DWORD DSLeaseIpAddress( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
COMM_DHCP_REPLY Reply;
PDHCP_ADAPTER Adapter;
struct protocol* proto;
ApiLock();
Adapter = AdapterFindIndex( Req->AdapterIndex );
Reply.Reply = Adapter ? 1 : 0;
if( Adapter ) {
proto = find_protocol_by_adapter( &Adapter->DhclientInfo );
if (proto)
remove_protocol(proto);
add_protocol( Adapter->DhclientInfo.name,
Adapter->DhclientInfo.rfdesc, got_one,
&Adapter->DhclientInfo );
Adapter->DhclientInfo.client->state = S_INIT;
state_reboot(&Adapter->DhclientInfo);
if (hAdapterStateChangedEvent != NULL)
SetEvent(hAdapterStateChangedEvent);
}
ApiUnlock();
return Send(CommPipe, &Reply );
}
DWORD DSQueryHWInfo( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
COMM_DHCP_REPLY Reply;
PDHCP_ADAPTER Adapter;
@ -186,81 +153,6 @@ DWORD DSQueryHWInfo( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
return Send(CommPipe, &Reply );
}
DWORD DSReleaseIpAddressLease( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
COMM_DHCP_REPLY Reply;
PDHCP_ADAPTER Adapter;
struct protocol* proto;
ApiLock();
Adapter = AdapterFindIndex( Req->AdapterIndex );
Reply.Reply = Adapter ? 1 : 0;
if( Adapter ) {
if (Adapter->NteContext)
{
DeleteIPAddress( Adapter->NteContext );
Adapter->NteContext = 0;
}
if (Adapter->RouterMib.dwForwardNextHop)
{
DeleteIpForwardEntry( &Adapter->RouterMib );
Adapter->RouterMib.dwForwardNextHop = 0;
}
proto = find_protocol_by_adapter( &Adapter->DhclientInfo );
if (proto)
remove_protocol(proto);
Adapter->DhclientInfo.client->active = NULL;
Adapter->DhclientInfo.client->state = S_INIT;
if (hAdapterStateChangedEvent != NULL)
SetEvent(hAdapterStateChangedEvent);
}
ApiUnlock();
return Send(CommPipe, &Reply );
}
DWORD DSRenewIpAddressLease( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
COMM_DHCP_REPLY Reply;
PDHCP_ADAPTER Adapter;
struct protocol* proto;
ApiLock();
Adapter = AdapterFindIndex( Req->AdapterIndex );
if( !Adapter || Adapter->DhclientState.state == S_STATIC ) {
Reply.Reply = 0;
ApiUnlock();
return Send(CommPipe, &Reply );
}
Reply.Reply = 1;
proto = find_protocol_by_adapter( &Adapter->DhclientInfo );
if (proto)
remove_protocol(proto);
add_protocol( Adapter->DhclientInfo.name,
Adapter->DhclientInfo.rfdesc, got_one,
&Adapter->DhclientInfo );
Adapter->DhclientInfo.client->state = S_INIT;
state_reboot(&Adapter->DhclientInfo);
if (hAdapterStateChangedEvent != NULL)
SetEvent(hAdapterStateChangedEvent);
ApiUnlock();
return Send(CommPipe, &Reply );
}
DWORD DSStaticRefreshParams( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req ) {
NTSTATUS Status;
COMM_DHCP_REPLY Reply;

View file

@ -393,18 +393,6 @@ DWORD WINAPI PipeThreadProc( LPVOID Parameter ) {
DSQueryHWInfo(PipeSend, CommPipe, &Req);
break;
case DhcpReqLeaseIpAddress:
DSLeaseIpAddress( PipeSend, CommPipe, &Req );
break;
case DhcpReqReleaseIpAddress:
DSReleaseIpAddressLease( PipeSend, CommPipe, &Req );
break;
case DhcpReqRenewIpAddress:
DSRenewIpAddressLease( PipeSend, CommPipe, &Req );
break;
case DhcpReqStaticRefreshParams:
DSStaticRefreshParams( PipeSend, CommPipe, &Req );
break;

View file

@ -196,84 +196,6 @@ DhcpQueryHWInfo(DWORD AdapterIndex,
return 1;
}
DWORD APIENTRY
DhcpLeaseIpAddress(DWORD AdapterIndex)
{
COMM_DHCP_REQ Req;
COMM_DHCP_REPLY Reply;
DWORD BytesRead;
BOOL Result;
ASSERT(PipeHandle != INVALID_HANDLE_VALUE);
Req.Type = DhcpReqLeaseIpAddress;
Req.AdapterIndex = AdapterIndex;
Result = TransactNamedPipe(PipeHandle,
&Req, sizeof(Req),
&Reply, sizeof(Reply),
&BytesRead, NULL);
if (!Result)
{
/* Pipe transaction failed */
return 0;
}
return Reply.Reply;
}
DWORD APIENTRY
DhcpReleaseIpAddressLease(DWORD AdapterIndex)
{
COMM_DHCP_REQ Req;
COMM_DHCP_REPLY Reply;
DWORD BytesRead;
BOOL Result;
ASSERT(PipeHandle != INVALID_HANDLE_VALUE);
Req.Type = DhcpReqReleaseIpAddress;
Req.AdapterIndex = AdapterIndex;
Result = TransactNamedPipe(PipeHandle,
&Req, sizeof(Req),
&Reply, sizeof(Reply),
&BytesRead, NULL);
if (!Result)
{
/* Pipe transaction failed */
return 0;
}
return Reply.Reply;
}
DWORD APIENTRY
DhcpRenewIpAddressLease(DWORD AdapterIndex)
{
COMM_DHCP_REQ Req;
COMM_DHCP_REPLY Reply;
DWORD BytesRead;
BOOL Result;
ASSERT(PipeHandle != INVALID_HANDLE_VALUE);
Req.Type = DhcpReqRenewIpAddress;
Req.AdapterIndex = AdapterIndex;
Result = TransactNamedPipe(PipeHandle,
&Req, sizeof(Req),
&Reply, sizeof(Reply),
&BytesRead, NULL);
if (!Result)
{
/* Pipe transaction failed */
return 0;
}
return Reply.Reply;
}
DWORD APIENTRY
DhcpStaticRefreshParams(DWORD AdapterIndex,
DWORD Address,

View file

@ -15,7 +15,7 @@
@ stdcall DhcpEnumClasses(long wstr long long)
@ stub DhcpFallbackRefreshParams
@ stdcall DhcpHandlePnPEvent(long long wstr long long)
@ stdcall DhcpLeaseIpAddress(long)
@ stub DhcpLeaseIpAddress
@ stub DhcpLeaseIpAddressEx
@ stdcall DhcpNotifyConfigChange(ptr ptr long long long long long)
@ stub DhcpNotifyConfigChangeEx
@ -25,11 +25,11 @@
@ stdcall DhcpQueryHWInfo(long ptr ptr ptr)
@ stub DhcpRegisterOptions
@ stub DhcpRegisterParamChange
@ stdcall DhcpReleaseIpAddressLease(long)
@ stub DhcpReleaseIpAddressLease
@ stub DhcpReleaseIpAddressLeaseEx
@ stdcall DhcpReleaseParameters(wstr)
@ stub DhcpRemoveDNSRegistrations
@ stdcall DhcpRenewIpAddressLease(long)
@ stub DhcpRenewIpAddressLease
@ stub DhcpRenewIpAddressLeaseEx
@ stub DhcpRequestOptions
@ stdcall DhcpRequestParams(long ptr ptr ptr long ptr long ptr ptr ptr ptr)

View file

@ -101,9 +101,6 @@ extern VOID ApiUnlock(VOID);
extern DWORD DSAcquireParams(PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req);
extern DWORD DSReleaseParams(PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req);
extern DWORD DSQueryHWInfo( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern DWORD DSLeaseIpAddress( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern DWORD DSStaticRefreshParams( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern DWORD DSGetAdapterInfo( PipeSendFunc Send, HANDLE CommPipe, COMM_DHCP_REQ *Req );
extern int inet_aton(const char *s, struct in_addr *addr);

View file

@ -4,10 +4,7 @@
enum {
DhcpReqAcquireParams,
DhcpReqReleaseParams,
DhcpReqLeaseIpAddress,
DhcpReqQueryHWInfo,
DhcpReqReleaseIpAddress,
DhcpReqRenewIpAddress,
DhcpReqStaticRefreshParams,
};

View file

@ -32,13 +32,10 @@ APIENTRY
DhcpReleaseParameters(
_In_ PWSTR AdapterName);
DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex );
DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex,
PDWORD MediaType,
PDWORD Mtu,
PDWORD Speed );
DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex );
DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex );
DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex,
DWORD Address,
DWORD Netmask );