Показать сообщение отдельно

  #6  
Старый 28.05.2007, 09:58
bl4ck-cat
Познающий
Регистрация: 17.06.2006
Сообщений: 76
Провел на форуме:
263627

Репутация: 32
По умолчанию

Код:
 BOOL (WINAPI *RegisterServiceProcess)(DWORD dwProcessId,DWORD dwType);

 int main(){

  HINSTANCE hKernel;
  int i=1;

  hKernel=LoadLibrary("KERNEL32.DLL");

  if(hKernel){
   cout<<"Success load library kernel32.dll"<< endl;
   RegisterServiceProcess=(int(__stdcall*)(DWORD,DWORD))

   GetProcAddress(hKernel,"RegisterServiceProcess");
   if(RegisterServiceProcess){
    cout<<"Success to have address of the specified exported dynamic-link library (DLL) function"<< endl;

    if(RegisterServiceProcess(GetCurrentProcessId(),i))
     cout<<"Success registers the process as a service process"<< endl;
   }else{
    cout<<"Failed to have address of the specified exported dynamic-link library (DLL) function"<< endl;
    cin>>i;
    return 0;
   }
   }else{
    cout<<"Failed load library kernel32.dll"<< endl;
    cin>>i;
    return 0;
   }
  cout<<"Registers the process as a service process:1"<< endl;
  cout<<"Unregisters the process as a service process:0"<< endl;
  cin>>i;
  if (RegisterServiceProcess(GetCurrentProcessId(),i)){
   cout<<"Success"<< endl;
  }else{
   cout<<"Failed"<< endl;
  }
  cin>>i;
  return 0;
 }

это всё вставлять в код своей прги... переменную count нужно удалить..

зы: нашел у себя на компе и не проверял на наличие ошибок так что ногами не йбейте