#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")
#include<stdio.h>
#include<windows.h>
#include<lm.h>intwmain(intargc,wchar_t*argv[]){DWORDdwError=0;NET_API_STATUSnStatus;//// All parameters are required.//if(argc!=2){fwprintf(stderr,L"Usage: %s username\n",argv[0]);exit(1);}//// Call the NetUserDel function to delete the share.//nStatus=NetUserDel(NULL,argv[1]);//// Display the result of the call.//if(nStatus==NERR_Success)fwprintf(stderr,L"success");elsefprintf(stderr,"%d",nStatus);return0;}
#include<Windows.h>
#include<stdio.h>intwmain(intargc,wchar_t*argv[]){HKEYhKey;longlResult;DWORDdwType=REG_DWORD;DWORDvalue=0;lResult=RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SYSTEM\CurrentControlSet\Control\Terminal Server",0,KEY_WRITE,&hKey);if(lResult==ERROR_SUCCESS){lResult=RegSetValueEx(hKey,L"fDenyTSConnections",0,dwType,(LPBYTE)&value,sizeof(DWORD));if(lResult==ERROR_SUCCESS){printf("success");}else{printf("failed");}}else{printf("Unable to open registry");}}