Beispiel #1
0
/*************************************************************************\
 * function WriteProfile()
 * Trys to open the file "bermuda.ini" and saves game specific options 
 * from the profile data. 
\*************************************************************************/
BOOL WriteProfile( HAB hab )
{
	HINI hini;
	PSZ pszIniNameCopy;
	ULONG tmpLineStyle;
	BOOL  tmpSound;


	pszIniNameCopy = (PSZ)alloca( strlen( pszIniName ) + 1);
	strcpy( pszIniNameCopy, pszIniName );
	if ( !(hini = PrfOpenProfile( hab, pszIniNameCopy )) ) goto Error;
	if( !PrfWriteProfileString( hini, pszAppName,
										 PrfKeys.pszVersion, pszVersion ) )
		goto Error;
	// write line style settings
	tmpLineStyle = InfoData.GetLineStyle();
	if( !PrfWriteProfileData( hini, pszAppName, PrfKeys.pszLineStyle,
									  &tmpLineStyle, (ULONG)sizeof( ULONG ) ) )
		goto Error;
	// write sound flag
	tmpSound = Sound::GetSoundWanted();
	if( !PrfWriteProfileData( hini, pszAppName, PrfKeys.pszSound,
		 &tmpSound, (ULONG)sizeof( BOOL ) ) )
		 goto Error;

	if( !StoreWindowPos( hini, pszAppName, PrfKeys.pszWinPos, hwndFrame ) )
		goto Error;
	PrfCloseProfile( hini );
	return TRUE;
Error:
	PrfCloseProfile( hini );
	return FALSE;
}
Beispiel #2
0
VOID GetOptionsFromIni( VOID )
{
    int TileSet, Input, Sound, Priority;

    hini = PrfOpenProfile (habMain, "MAKMAN.INI");

    TileSet  = PrfQueryProfileInt(hini,szAppName,"Tile Set", 1);
    Input    = PrfQueryProfileInt(hini,szAppName,"Input Source", 0);
    Sound    = PrfQueryProfileInt(hini,szAppName,"Sound Enabled", 1);
    Priority = PrfQueryProfileInt(hini,szAppName,"Priority", 0);

    if (debOut)
    {
        fprintf(debOut, "TS : %i, Input %i, Sound %i, Prio %i\n", TileSet, Input, Sound, Priority);
        fflush(debOut);
    }

    SetDefault (IDM_T_CLASSIC + TileSet);
    SetDefault (IDM_KEYBOARD + Input);
    if (Sound)
        SetDefault (IDM_SOUND_ON);
    else
        SetDefault (IDM_SOUND_OFF);
    SetDefault (IDM_PRI_NORMAL + Priority);

    PrfCloseProfile(hini);
}
void RecallWindowSizePos(void)
{
    int deskw,deskh;
    GetDefaultWH(deskw,deskh);
    char ws[32+1];
    char hs[32+1];
    sprintf(ws,"%d",deskw);
    sprintf(hs,"%d",deskh);
    ///
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    char s[MAXPATHSIZE];
    s[0] = NULL;
    PrfQueryProfileString(hini,"profsowl","X","16",s,32);
    int x = atoi(s);
    PrfQueryProfileString(hini,"profsowl","Y","3",s,32);
    int y = atoi(s);
    PrfQueryProfileString(hini,"profsowl","Width",ws,s,32);
    int w = atoi(s);
    PrfQueryProfileString(hini,"profsowl","Height",hs,s,32);
    int h = atoi(s);
    PrfCloseProfile(hini);
    //
    // IF Something Valid To Recall !
    //
    if(x >= 0 && x < 1000 && y >= 0 && y < 1000)
    {
        MainFramePtr->MoveWindow(x,y,w,h,TRUE);
    }
}
void Profile::PhaseOut ( ) {

   #ifdef __OS2__

      if ( Handle && Opened ) {
         Log ( "Profile::PhaseOut: Phasing out '%s'.", ProfileName ) ;
         if ( !PrfCloseProfile ( Handle ) ) {
            char Message [512] ;
            Log ( "Profile::PhaseOut: Could not close INI file.  %s", InterpretWinError(0,Message) ) ;
         } /* endif */
         Handle = 0 ;
         Opened = FALSE ;
         char Drive[_MAX_DRIVE+1]; char Dir[_MAX_DIR+1]; char FName[_MAX_FNAME+1]; char Ext[_MAX_EXT+1] ;
         _splitpath ( ProfileName, Drive, Dir, FName, Ext ) ;
         char NewName [_MAX_PATH] ;
         sprintf ( NewName, "%s%s%s.BAK", Drive, Dir, FName ) ;
         if ( !access ( NewName, 0 ) ) 
            if ( remove ( NewName ) )
               Log ( "Profile::PhaseOut: Could not remove '%s'.", NewName ) ;
         if ( rename ( ProfileName, NewName ) ) 
            Log ( "Profile::PhaseOut: Could not rename '%s' to '%s'.", ProfileName, NewName ) ;
      } /* endif */

   #else // __NT__

      // We're not going to implement this one for now, as the only reason for it was
      //   to convert from MemSize 3.31's INI file to MemSize 4.00's file, and the Win32
      //   version had no version before 4.00.

   #endif // __OS2__ vs __NT__

} /* endmethod */
Profile::~Profile ( ) {

  /**************************************************************************
   * Release allocated memory.                                              *
   **************************************************************************/

   delete [] Name ;

  /**************************************************************************
   * Close the profile.                                                     *
   **************************************************************************/

   #ifdef __OS2__

      if ( Handle && Opened ) {
         if ( !PrfCloseProfile ( Handle ) ) {
            char Message [512] ;
            Log ( "Profile::~Profile: Could not close INI file.  %s", InterpretWinError(0,Message) ) ;
         } /* endif */
      } /* endif */

   #endif // __OS2__

  /**************************************************************************
   * Mark unready, just in case somebody tries to use the object anyway.    *
   **************************************************************************/

   Ready = FALSE ;

} /* endmethod */
Beispiel #6
0
BOOL PRF_SetProfileString (PPRF_PROFILESTRING CustomPtr) {
   HINI INIHandle    = 0;
   BOOL ErrorOccured = FALSE;
   BOOL NeedToClose  = FALSE;

   // Uppercase filename...
   strupr (CustomPtr->Inis);

   // Check for hardcoded SYSTEM/USER...
   if (strcmp(CustomPtr->Inis, "HINI_SYSTEM")==0) {
      INIHandle = HINI_SYSTEMPROFILE;
    } else if (strcmp(CustomPtr->Inis, "HINI_USER")==0) {
      INIHandle = HINI_USERPROFILE;
    } else {
      // We assume that the string is an INI-Filename...
      if (!(INIHandle   = PrfOpenProfile(MINSTALL_PMHandle, CustomPtr->Inis)))
         ErrorOccured = TRUE;
      NeedToClose = TRUE;
    }

   if (INIHandle) {
      // Got valid INI-Handle, so write the string...
      ErrorOccured = !PrfWriteProfileString(INIHandle, CustomPtr->AppNames, CustomPtr->KeyNames, CustomPtr->Datas);
    } else ErrorOccured = TRUE;
   if (NeedToClose) PrfCloseProfile(INIHandle);
   return !ErrorOccured;
 }
/*
	query_profile_data
	Read configuration data from the selected INI file.
	There should be no reason to alter the code.
*/
ULONG	query_profile_data()
{
	HINI	ini_file;
	BOOL	fSuccess;
	ULONG	size;

	if(*ini_filename){
		ini_file = PrfOpenProfile(hab, (PSZ)ini_filename);
		if(ini_file == NULLHANDLE)
			ini_file = HINI_USER;
	}else
		ini_file = HINI_USER;

	size = sizeof(configuration_data);
	fSuccess = PrfQueryProfileData(ini_file,
	  (PSZ)application_name, (PSZ)modulename,
	  (PSZ)&configuration_data, &size);

	if(ini_file != HINI_USER)
		PrfCloseProfile(ini_file);
	if(fSuccess == FALSE)
		return 0;
	else
		return size;
}
void ForgetProjectPath(void)
{
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    PrfWriteProfileString(hini,"profsowl","ProjectPath",".\\");
    PrfCloseProfile(hini);
}
Beispiel #9
0
/*************************************************************************\
 * function ReadProfile()
 * Tries to open the file "bermuda.ini" and sets game specific options taken
 * from the profile data. If the file isn't found or the data is invalid
 * FALSE is returned otherwise the function returns TRUE.
\*************************************************************************/
BOOL ReadProfile( HAB hab )
{
	CHAR pszVersionFound[MaxVersionLen] = "";
	ULONG lNumRead;
	ULONG tmpLineStyle;
	BOOL  tmpSound;
	HINI hini;
	PSZ pszIniNameCopy;


	pszIniNameCopy = (PSZ)alloca( strlen( pszIniName ) + 1);
	strcpy( pszIniNameCopy, pszIniName );
	if ( !(hini = PrfOpenProfile( hab, pszIniNameCopy )) ) goto Error;

	// query version string
	PrfQueryProfileString( hini, pszAppName, PrfKeys.pszVersion, NULL,
								  pszVersionFound, MaxVersionLen );
	// and compare with current version								  
	if ( strcmp( pszVersion, pszVersionFound ) != 0 ){
		PrfCloseProfile( hini );
		return FALSE;
	}

	// retrieve line style settings
	lNumRead = sizeof( ULONG );
	if( !PrfQueryProfileData( hini, pszAppName, PrfKeys.pszLineStyle,
		 &tmpLineStyle, &lNumRead ) ) goto Error;
	InfoData.SetLineStyle( tmpLineStyle );		 
	// retrieve sound flag
	lNumRead = sizeof( BOOL );
	if( !PrfQueryProfileData( hini, pszAppName, PrfKeys.pszSound,
		 &tmpSound, &lNumRead ) )
		 goto Error;
	Sound::SetSoundWanted( tmpSound );		 

	if ( !RestoreWindowPos( hini, pszAppName, PrfKeys.pszWinPos, hwndFrame )
		) goto Error;
	PrfCloseProfile( hini );
	return TRUE;

Error:
	PrfCloseProfile( hini );
	return FALSE;
}
Beispiel #10
0
VOID SaveScoresToIni( VOID )
{
    hini = PrfOpenProfile(habMain, "MAKMAN.INI");

    PrfWriteProfileData(hini, szAppName, "ScoreNames", topNames, 15*100);
    PrfWriteProfileData(hini, szAppName, "Scores", topScores, 15 * sizeof(long));

    PrfCloseProfile(hini);

}
void RememberProjectPath(void)
{
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    char s[512];
    getcwd(s,sizeof(s));
    PrfWriteProfileString(hini,"profsowl","ProjectPath",s);
    PrfCloseProfile(hini);
}
Beispiel #12
0
VOID GetScoresFromIni ( VOID )
{
    ULONG bMax;

    hini = PrfOpenProfile(habMain, "MAKMAN.INI");

    bMax = 15*100;
    PrfQueryProfileData(hini, szAppName, "ScoreNames", topNames, &bMax);
    bMax = 15 * sizeof(long);
    PrfQueryProfileData(hini, szAppName, "Scores", topScores, &bMax);

    PrfCloseProfile(hini);
}
// try loading each plugin module.
// if opened sucessfully, call the plugin's CBZParseAttributes(hIni, keyValue, count) function
// the plugin is responsible for writing data to the ini file.
BOOL ApplyPreviewTheme(HWND hwndPreview, char themeFile[])
{
    HINI hIni;
    int count = 0;
    char szProfile[CCHMAXPATH + 1];
    char szPluginBase[CCHMAXPATH];

    // get profile name
    if (!PrfQueryProfileString(HINI_USERPROFILE,
                               "CandyBarZ",
                               "Profile",
                               NULL,
                               szProfile,
                               CCHMAXPATH))
    {
        PSUTErrorFunc(NULLHANDLE, "Error", "ApplyPreviewTheme", "Failed to Get Profile Filename", 0UL);
        return FALSE;
    }

    // get profile name
    if (!PrfQueryProfileString(HINI_USERPROFILE,
                               "CandyBarZ",
                               "BasePath",
                               NULL,
                               szPluginBase,
                               CCHMAXPATH))
    {
        PSUTErrorFunc(NULLHANDLE, "Error", "ApplyPreviewTheme", "Failed to Get BasePath", 0UL);
        return FALSE;
    }


    if ((hIni = PrfOpenProfile(WinQueryAnchorBlock(hwndPreview), szProfile)) == NULLHANDLE)
    {
        PSUTErrorFunc(NULLHANDLE, "Error", "ApplyPreviewTheme", "Failed to Open Profile", 0UL);
        return FALSE;
    }

    count = ApplyPreviewBlock(hwndPreview, themeFile, "TITLEBAR", szPluginBase, hIni, 0);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "FRAME", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "FRAMEBRDR", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "PUSHBUTTON", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "RADIOBUTTON", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "CHECKBOX", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "MINMAX", szPluginBase, hIni, count);
    count = ApplyPreviewBlock(hwndPreview, themeFile, "MENU", szPluginBase, hIni, count);
    //insert here!!!!
    PrfCloseProfile(hIni);
    return TRUE;
}
Beispiel #14
0
BOOL  RestoreSettings( HWND hwndClient, HAB habAnchor )
{
   HINI  hiniPrf;
   CHAR *pLastSlash;


   /*
    * Construct a fully qualified profile file name (path and
    * file name) from the full path/name of the executable.
    */

   strncpy( szProfileFile, szExecFile, sizeof( szProfileFile ) );
   pLastSlash = strrchr( szProfileFile, '\\' );
   strcpy( pLastSlash + 1, szPrfBaseName );

   /*
    * Now open that profile file
    */

   hiniPrf = PrfOpenProfile( habAnchor, szProfileFile );

   /*
    * If the profile open was successful, restore the data therein
    */

   if ( hiniPrf != NULLHANDLE )
   {
      /*
       * Allow all modules to restore settings from the profile file
       */

      h2cursor_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2edit_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2file_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2font_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2help_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2reg_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2screen_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2search_restore( hwndClient, hiniPrf, (PSZ)szPrfAppName );

      /*
       * Close the profile file and return TRUE
       */

      PrfCloseProfile( hiniPrf );
      return TRUE;
   }

   return FALSE;
}
Beispiel #15
0
//
// Save MakMan/2 Options from INI files
//
VOID SaveOptionsToIni( VOID )
{
    int TileSet, Input, Sound, Priority;

    hini = PrfOpenProfile(habMain, "MAKMAN.INI");

    if (WinIsMenuItemChecked(hwndMenu, IDM_T_CLASSIC))
        TileSet = 0;
    else
       if (WinIsMenuItemChecked(hwndMenu, IDM_T_3D))
          TileSet = 1;
       else
            TileSet = 2;


    if (WinIsMenuItemChecked(hwndMenu, IDM_KEYBOARD))
        Input = 0;
    if (WinIsMenuItemChecked(hwndMenu, IDM_JOY_A))
        Input = 1;
    if (WinIsMenuItemChecked(hwndMenu, IDM_JOY_B))
        Input = 2;


    if (WinIsMenuItemChecked(hwndMenu, IDM_SOUND_ON))
        Sound = 1;
    else
        Sound = 0;

    if (WinIsMenuItemChecked(hwndMenu, IDM_PRI_NORMAL))
        Priority = 0;
    if (WinIsMenuItemChecked(hwndMenu, IDM_PRI_CRIT))
        Priority = 1;
    if (WinIsMenuItemChecked(hwndMenu, IDM_PRI_SERVER))
        Priority = 2;


    if (debOut)
    {
        fprintf(debOut, "TS : %i, Input %i, Sound %i, Prio %i\n", TileSet, Input, Sound, Priority);
        fflush(debOut);
    }

    WriteProfileInt ("Tile Set", TileSet);
    WriteProfileInt ("Input Source", Input);
    WriteProfileInt ("Sound Enabled", Sound);
    WriteProfileInt ("Priority", Priority);

    PrfCloseProfile(hini);
}
Beispiel #16
0
Profile::~Profile ( ) {

 /***************************************************************************
  * Release allocated memory.                                               *
  ***************************************************************************/

  delete [] Name ;

 /***************************************************************************
  * Close the profile.                                                      *
  ***************************************************************************/

  if ( Handle )
     PrfCloseProfile ( Handle ) ;
}
Beispiel #17
0
void
play_system_sound(char *id)
{
HINI hini;
char buf[MAXSTR];
char *p;
	if ( (hini = PrfOpenProfile(hab, szMMini)) == NULLHANDLE )
	    return;
	PrfQueryProfileString(hini, (PCSZ)"MMPM2_AlarmSounds", (PCSZ)id, (PCSZ)"##", buf, sizeof(buf));
	PrfCloseProfile(hini);
    	p = strchr(buf,'#');
    	if (p != (char *)NULL) {
	    *p = '\0';
	    (*pfnMciPlayFile)(hwnd_frame, (PSZ)buf, 0, 0, 0);
	}
	return;
}
void RecallProjectPath(char *rs, int ChDir)
{
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    char s[MAXPATHSIZE];
    PrfQueryProfileString(hini,"profsowl","ProjectPath",".\\",s,sizeof(s));
    PrfCloseProfile(hini);

    if(ChDir && s[1] == ':')
    {
        ChPath(s);
    }

    if(rs)
    {
        strcpy(rs,s);
    }
}
void SaveWindowSizePos(void)
{
    int x = MainFramePtr->Attr.X;
    int y = MainFramePtr->Attr.Y;

    SWP swp;
    WinQueryWindowPos(MainFramePtr->HWindow, &swp);
    int w = swp.cx;
    int h = swp.cy;

    static int oldx, oldy, oldw, oldh;
    ///
    if(x == oldx && y == oldy && w == oldw && h == oldh)
    {
        return;
    }
    ////
    oldx = x;
    oldy = y;
    oldw = w;
    oldh = h;
    ////
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    if(!hini)
        return;

    char s[32+1];
    s[0] = NULL;
    sprintf(s,"%d",x);
    PrfWriteProfileString(hini,"profsowl","X",s);
    sprintf(s,"%d",y);
    PrfWriteProfileString(hini,"profsowl","Y",s);
    sprintf(s,"%d",w);
    PrfWriteProfileString(hini,"profsowl","Width",s);
    sprintf(s,"%d",h);
    PrfWriteProfileString(hini,"profsowl","Height",s);
    PrfCloseProfile(hini);
}
Beispiel #20
0
void ZProfile::closeRoot ()
{
  ZFUNCTRACE_DEVELOP ("ZProfile::closeRoot()");
#ifdef ZC_WIN
  if (iRootHandle)
      {
        closePath ();
        closeHandle ((HKEY) iRootHandle);
        iRootHandle = 0;
      }                         // if
#endif
#ifdef ZC_OS2
  if (iRootHandle != 0 &&
      iRootHandle != HINI_SYSTEMPROFILE && iRootHandle != HINI_USERPROFILE)
      {
        if (!PrfCloseProfile (iRootHandle))
          throwSysErr (PrfCloseProfileName);
        iRootHandle = 0;
      }                         // if
#endif
}                               // closeRoot
Beispiel #21
0
BOOL  SaveSettings( HWND hwndClient, HAB habAnchor )
{
   HINI  hiniPrf;


   /*
    * Open the profile file
    */

   hiniPrf = PrfOpenProfile( habAnchor, szProfileFile );

   /*
    * If the profile open was successful, save what needs to be saved therein.
    */

   if ( hiniPrf != NULLHANDLE )
   {
      /*
       * Allow all modules to save settings to the profile file
       */

      h2cursor_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2edit_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2file_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2font_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2help_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2reg_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2screen_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );
      h2search_save( hwndClient, hiniPrf, (PSZ)szPrfAppName );

      /*
       * Close the profile file and return TRUE
       */

      PrfCloseProfile( hiniPrf );
      return TRUE;
   }

   return FALSE;
}
void LoadToolSettings(void)
{
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);
    //
    int ns = sizeof(UserTools[1].Name);
    int ps = sizeof(UserTools[1].Path);
    int ds = sizeof(UserTools[1].Dir);
    //
    HAB hab;
    HINI hini = PrfOpenProfile(hab,path);
    PrfQueryProfileString(hini,"profsowl","Tool1Name","",UserTools[1].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool2Name","",UserTools[2].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool3Name","",UserTools[3].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool4Name","",UserTools[4].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool5Name","",UserTools[5].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool6Name","",UserTools[6].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool7Name","",UserTools[7].Name,ns);
    PrfQueryProfileString(hini,"profsowl","Tool8Name","",UserTools[8].Name,ns);
    //--
    PrfQueryProfileString(hini,"profsowl","Tool1Path","",UserTools[1].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool2Path","",UserTools[2].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool3Path","",UserTools[3].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool4Path","",UserTools[4].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool5Path","",UserTools[5].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool6Path","",UserTools[6].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool7Path","",UserTools[7].Path,ps);
    PrfQueryProfileString(hini,"profsowl","Tool8Path","",UserTools[8].Path,ps);
    //--
    PrfQueryProfileString(hini,"profsowl","Tool1Dir","",UserTools[1].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool2Dir","",UserTools[2].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool3Dir","",UserTools[3].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool4Dir","",UserTools[4].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool5Dir","",UserTools[5].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool6Dir","",UserTools[6].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool7Dir","",UserTools[7].Dir,ds);
    PrfQueryProfileString(hini,"profsowl","Tool8Dir","",UserTools[8].Dir,ds);
    PrfCloseProfile(hini);
}
void SetTool::SaveToolSettings(void)
{
    char path[400+1];
    sprintf(path,"%s\\PROFOWL.INI",MyHomePath);

    HAB hab;
    HINI  hini = PrfOpenProfile(hab,path);
    //
    PrfWriteProfileString(hini,"profsowl","Tool1Name",UserTools[1].Name);
    PrfWriteProfileString(hini,"profsowl","Tool2Name",UserTools[2].Name);
    PrfWriteProfileString(hini,"profsowl","Tool3Name",UserTools[3].Name);
    PrfWriteProfileString(hini,"profsowl","Tool4Name",UserTools[4].Name);
    PrfWriteProfileString(hini,"profsowl","Tool5Name",UserTools[5].Name);
    PrfWriteProfileString(hini,"profsowl","Tool6Name",UserTools[6].Name);
    PrfWriteProfileString(hini,"profsowl","Tool7Name",UserTools[7].Name);
    PrfWriteProfileString(hini,"profsowl","Tool8Name",UserTools[8].Name);
    //--
    PrfWriteProfileString(hini,"profsowl","Tool1Path",UserTools[1].Path);
    PrfWriteProfileString(hini,"profsowl","Tool2Path",UserTools[2].Path);
    PrfWriteProfileString(hini,"profsowl","Tool3Path",UserTools[3].Path);
    PrfWriteProfileString(hini,"profsowl","Tool4Path",UserTools[4].Path);
    PrfWriteProfileString(hini,"profsowl","Tool5Path",UserTools[5].Path);
    PrfWriteProfileString(hini,"profsowl","Tool6Path",UserTools[6].Path);
    PrfWriteProfileString(hini,"profsowl","Tool7Path",UserTools[7].Path);
    PrfWriteProfileString(hini,"profsowl","Tool8Path",UserTools[8].Path);
    //--
    PrfWriteProfileString(hini,"profsowl","Tool1Dir",UserTools[1].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool2Dir",UserTools[2].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool3Dir",UserTools[3].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool4Dir",UserTools[4].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool5Dir",UserTools[5].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool6Dir",UserTools[6].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool7Dir",UserTools[7].Dir);
    PrfWriteProfileString(hini,"profsowl","Tool8Dir",UserTools[8].Dir);
    PrfCloseProfile(hini);
}
Beispiel #24
0
BOOL PRF_SetProfileData (PPRF_PROFILEDATA CustomPtr) {
   HMODULE DLLHandle    = 0;
   PVOID   ResourcePtr  = 0;
   ULONG   ResourceSize = 0;
   HINI    INIHandle    = 0;
   BOOL    ErrorOccured = FALSE;
   BOOL    NeedToClose  = FALSE;

   if ((DLLHandle = DLL_Load(CustomPtr->Dll))!=0) {
      if (DLL_GetDataResource (DLLHandle, CustomPtr->Id, &ResourcePtr, &ResourceSize)) {
         // Uppercase filename...
         strupr (CustomPtr->Ini);

         // Check for hardcoded SYSTEM/USER...
         if (strcmp(CustomPtr->Ini, "HINI_SYSTEM")==0) {
            INIHandle = HINI_SYSTEMPROFILE;
          } else if (strcmp(CustomPtr->Ini, "HINI_USER")==0) {
            INIHandle = HINI_USERPROFILE;
          } else {
            // We assume that the string is an INI-Filename...
            if (!(INIHandle   = PrfOpenProfile(MINSTALL_PMHandle, CustomPtr->Ini)))
               ErrorOccured = TRUE;
            NeedToClose = TRUE;
          }
       } else ErrorOccured = TRUE;
    } else ErrorOccured = TRUE;

   if (INIHandle) {
      // Got valid INI-Handle, so write the string...
      ErrorOccured = !PrfWriteProfileData(INIHandle, CustomPtr->AppName, CustomPtr->KeyName, ResourcePtr, ResourceSize);
    } else ErrorOccured = TRUE;

   if (NeedToClose) PrfCloseProfile(INIHandle);
   if (DLLHandle)   DLL_UnLoad(DLLHandle);
   return !ErrorOccured;
 }
BOOL launchPad::lpSaveObjectList()
{
  SOMClass *folderClass;
  WPFolder *wpFolder;
  char chrPath[CCHMAXPATH];
  ULONG ulBufferSize;
  HINI hIni;
  char * memPtr;
  HOBJECT *hObject;
  HOBJECT hObject2;
  int a;
  LPObject *lpoTemp;

  /* First check the config folder */
  if((hObject2=WinQueryObject(chrConfigID))==NULLHANDLE)
    {
      /* Toolbar folder lost recreate it */
      if(!checkFileExists(chrConfigTarget))
        return FALSE; /* No install dir defined */
      
      sprintf(chrPath,"OBJECTID=%s",chrConfigID);
      if((hObject2=WinCreateObject("WPFolder", chrConfigID, chrPath,chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE)
        return FALSE; /* Can't create new toolbar folder */
    }
  
  /* Get toolbar folder */
  if(somIsObj(wpParentFolder)) {
    folderClass=wpParentFolder->somGetClass();
    if(somIsObj(folderClass))
      wpFolder=(WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrConfigID, FALSE);
  }

  ulBufferSize=sizeof(chrPath);
  wpFolder->wpQueryRealName(chrPath, &ulBufferSize, TRUE);
  strcat(chrPath,"\\objects.ini");/* Ini-File containing the hobjects */
  
  //  WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrPath, "~launchPad", 123, MB_OK| MB_MOVEABLE);  
  do{
    /* Open the ini-file */
    if((hIni=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),chrPath))==NULLHANDLE)
      break; 

    if((memPtr=(char*)malloc(ulNumObjects*sizeof(HOBJECT)))==NULL)
      break;
    

    hObject=(HOBJECT*)memPtr;

    lpoTemp=lpoObjectList;
    for(a=ulNumObjects;a>0 && lpoTemp; a--)
      {
        hObject[a-1]=lpoTemp->hObject;
        lpoTemp=lpoTemp->lpoNext;
      }

    if(!PrfWriteProfileData(hIni,"objects","handles", hObject, ulNumObjects*sizeof(HOBJECT))) {
      free(hObject);
      break;
    }

    free(hObject);
    
    PrfCloseProfile(hIni);
    return TRUE;
  }while(TRUE);

  if(hIni)
    PrfCloseProfile(hIni);
  return FALSE;
}
BOOL launchPad::lpBuildObjectList(char * chrFolderID)
{
  WPObject* wpObject;

  char chrText[200];  
  ULONG ul;

  SOMClass *folderClass;
  WPFolder *wpFolder;
  char chrPath[CCHMAXPATH];
  ULONG ulBufferSize;
  HINI hIni;
  char * memPtr;
  HOBJECT *hObjectArray;
  int a;
  LPObject *lpoTemp;
  WPObject * wpTempObject;


  /* Get toolbar folder */
  if(somIsObj(wpParentFolder)) {
    folderClass=wpParentFolder->somGetClass();
    if(somIsObj(folderClass))
      wpFolder=(WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrFolderID, FALSE);
    if(!somIsObj(wpFolder))
      return FALSE;
  }
  
  /* Build ini name */
  ulBufferSize=sizeof(chrPath);
  wpFolder->wpQueryRealName(chrPath, &ulBufferSize, TRUE);
  strcat(chrPath,"\\objects.ini");/* Ini-File containing the hobjects */
  
  do{
    /* Open the ini-file */
    if((hIni=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),chrPath))==NULLHANDLE)
      break; 
 
    if(!PrfQueryProfileSize(hIni,"objects","handles", &ulBufferSize))
      break;

    if(ulBufferSize==0)
      break;/* No entries yet */

    if((memPtr=(char*)malloc(ulBufferSize))==NULL)
      break;
    
    ulNumObjects=ulBufferSize/sizeof(HOBJECT);    

    if(!PrfQueryProfileData(hIni,"objects","handles", memPtr, &ulBufferSize)){
      free(memPtr);
      break;
    }

    hObjectArray=(HOBJECT*)memPtr;
    ulBufferSize=ulNumObjects;
    for(a=0;a<ulBufferSize && lpoTemp; a++)
      {
        wpTempObject=((M_WPObject*)folderClass)->wpclsQueryObject(hObjectArray[a]);
        if(somIsObj(wpTempObject)) {
          if((lpoTemp=new LPObject(wpTempObject->wpQueryIcon()))!=NULL) {
            lpoTemp->wpObject=wpTempObject;
            wpTempObject->wpLockObject();
            lpoTemp->hObject=hObjectArray[a];
            //            lpoTemp->hPtr=wpTempObject->wpQueryIcon();
            /* Title of the object */
            strncpy(lpoTemp->chrName, wpTempObject->wpQueryTitle(),sizeof(lpoTemp->chrName));
            lpoTemp->lpParent=this;
            
            lpoTemp->lpoNext=lpoObjectList;
            lpoObjectList=lpoTemp;
          }
        }
        else {
          ulNumObjects--;
        }
      }/* for */
    
    free(hObjectArray);
    
    PrfCloseProfile(hIni);
    return TRUE;
  }while(TRUE);

  if(hIni)
    PrfCloseProfile(hIni);
  return FALSE;

}
// Поток приложения вызывает WindowProc всякий раз, когда для окна есть сообщение.
// Window - окно, Message - сообщение, *_parameter - данные, которые передаются вместе с сообщением.
MRESULT EXPENTRY Keyboard_Echo_WndProc( HWND Window, ULONG Message, MPARAM First_parameter, MPARAM Second_parameter )
{
 // Указатель на страницу.
 PPAGE Page = Enhancer.Pages.Keyboard_echo;

 // Проверяем сообщение.
 switch( Message )
  {
   // Отображаем настройки.
   case SM_SHOW_SETTINGS:
    {
     BYTE Value = 0; if( Clicker.Settings.Keyboard_echo ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Echo.Settings.Play_sound, BM_SETCHECK, MPFROMLONG( Value ), 0 );
     WinEnableControl( Window, Keyboard_Echo.Settings.For_IRC, Value );
     WinEnableControl( Window, Keyboard_Echo.Settings.For_ICQ, Value );
     WinEnableControl( Window, Keyboard_Echo.Settings.Use_RAMFS, Value );

     Value = 0; if( Clicker.Settings.Keyboard_echo_for_IRC ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Echo.Settings.For_IRC, BM_SETCHECK, MPFROMLONG( Value ), 0 );

     Value = 0; if( Clicker.Settings.Keyboard_echo_for_ICQ ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Echo.Settings.For_ICQ, BM_SETCHECK, MPFROMLONG( Value ), 0 );

     Value = 0; if( Clicker.Settings.Cache_echo_file ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Echo.Settings.Use_RAMFS, BM_SETCHECK, MPFROMLONG( Value ), 0 );
    }
   return 0;

   // Следим за полями ввода.
   case WM_CONTROL:
    {
     ULONG WM_Control_Window_ID = SHORT1FROMMP( First_parameter );
     ULONG WM_Control_Action_ID = SHORT2FROMMP( First_parameter );

     if( WM_Control_Window_ID == Keyboard_Echo.Settings.Play_sound )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Clicker.Settings.Keyboard_echo = 0;
           else Clicker.Settings.Keyboard_echo = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }

     if( WM_Control_Window_ID == Keyboard_Echo.Settings.For_IRC )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Clicker.Settings.Keyboard_echo_for_IRC = 0;
           else Clicker.Settings.Keyboard_echo_for_IRC = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }

     if( WM_Control_Window_ID == Keyboard_Echo.Settings.For_ICQ )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Clicker.Settings.Keyboard_echo_for_ICQ = 0;
           else Clicker.Settings.Keyboard_echo_for_ICQ = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }

     if( WM_Control_Window_ID == Keyboard_Echo.Settings.Use_RAMFS )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Clicker.Settings.Cache_echo_file = 0;
           else Clicker.Settings.Cache_echo_file = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }
    }
   return 0;

   // Обрабатываем нажатия на кнопки.
   case WM_COMMAND:
    {
     ULONG WM_Control_Button_ID = SHORT1FROMMP( First_parameter );

     if( WM_Control_Button_ID == OK_BUTTON_ID )
      {
       CHAR Settings_file_name[ SIZE_OF_PATH ] = ""; GetSettingsFileName( Settings_file_name );
       HINI Ini_file = OpenIniProfile( Enhancer.Application, Settings_file_name );

       if( Ini_file )
        {
         PrfWriteProfileData( Ini_file, "Settings", "Keyboard echo", &Clicker.Settings.Keyboard_echo, sizeof( BYTE ) );
         PrfWriteProfileData( Ini_file, "Settings", "Keyboard echo for IRC", &Clicker.Settings.Keyboard_echo_for_IRC, sizeof( BYTE ) );
         PrfWriteProfileData( Ini_file, "Settings", "Keyboard echo for ICQ", &Clicker.Settings.Keyboard_echo_for_ICQ, sizeof( BYTE ) );
         PrfWriteProfileData( Ini_file, "Settings", "Cache echo file", &Clicker.Settings.Cache_echo_file, sizeof( BYTE ) );

         PrfCloseProfile( Ini_file );

         BroadcastRSMessages();
         NiceReadSettings();
        }
      }

     if( WM_Control_Button_ID == PD_BUTTON_ID )
      {
       if( Page->SetDefSettings ) Page->SetDefSettings( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext1 ) Page->SetDefSettings_Ext1( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext2 ) Page->SetDefSettings_Ext2( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext3 ) Page->SetDefSettings_Ext3( Page->Settings_to_show );

       WinPostMsg( Window, WM_COMMAND, (MPARAM) OK_BUTTON_ID, 0 );
      }

     if( WM_Control_Button_ID == HP_BUTTON_ID )
      {
       Help( Page->Settings_to_show, Enhancer.Code_page );
      }
    }
   return 0;
  }

 // Возврат.
 return WinDefWindowProc( Window, Message, First_parameter, Second_parameter );
}
static  BOOL    saveProfile(HAB hab)
{
#ifdef DEBUG
    TRACE("in saveProfile ... ") ;
#endif

    int     entry, i, id ;
    HINI    hini  ;
    BOOL    stat  ;
    ULONG   len   ;
    UCHAR   key[32] ;

#ifdef DEBUG
    TRACE("done in saveProfile\n") ;
#endif

    /*
     * save to profile
     */

    if ((hini = PrfOpenProfile(hab, ProfilePath)) == NULLHANDLE) {

#ifdef DEBUG
        TRACE("saveProfile - failed to open %s\n", ProfilePath) ;
#endif

        return FALSE ;
    }

    /*
     * re-load new profile
     */

    len = sizeof(profOrder) ;
    stat = PrfQueryProfileData(hini, ProgramName, "ORDER", profOrder, &len) ;

    if (stat != TRUE || len != sizeof(profOrder)) {
        memset(profOrder, 0xff, sizeof(profOrder)) ;
    }

    for (i = 0 ; i < MAXHOSTS ; i++) {
        if ((id = profOrder[i]) == 0xff) {
            continue ;
        }
        sprintf(key, "HOST%02d", id) ;
        len = sizeof(HOSTREC) ;
        stat = PrfQueryProfileData(hini,
                    ProgramName, key, &profHosts[id], &len) ;
        if (stat != TRUE || len != sizeof(HOSTREC)) {
            profOrder[i] = 0xff ;
        }
    }

    /*
     * select new entry
     */

    if ((entry = saveParam()) < 0) {
        PrfCloseProfile(hini) ;
        return FALSE ;
    }

    /*
     * save new order and host data
     */

    sprintf(key, "HOST%02d", entry) ;
    PrfWriteProfileData(hini, ProgramName,
                "ORDER", profOrder, sizeof(profOrder)) ;
    PrfWriteProfileData(hini, ProgramName,
                key, &profHosts[entry], sizeof(HOSTREC)) ;

    PrfCloseProfile(hini) ;

#ifdef DEBUG
    TRACE("saveProfile ... saved to %d\n", entry) ;
#endif

    return TRUE ;
}
static  BOOL    loadProfile(HAB hab)
{
    HINI    hini ;
    BOOL    stat ;
    ULONG   len  ;
    int     i, id ;
    UCHAR   key[32] ;

#ifdef DEBUG
    TRACE("loadProfile [%s]\n", ProfilePath) ;
#endif

    /*
     * load host order
     */

    if ((hini = PrfOpenProfile(hab, ProfilePath)) == NULLHANDLE) {

#ifdef DEBUG
        TRACE("loadProfile - failed to open %s\n", ProfilePath) ;
#endif

        return FALSE ;
    }

    len = sizeof(profOrder) ;
    stat = PrfQueryProfileData(hini, ProgramName, "ORDER", profOrder, &len) ;

    if (stat != TRUE || len != sizeof(profOrder)) {
        PrfCloseProfile(hini) ;
        memset(profOrder, 0xff, sizeof(profOrder)) ;

#ifdef DEBUG
        TRACE("loadProfile - failed to read Order\n") ;
#endif

        return FALSE ;
    }

    /*
     * load host informations
     */

    for (i = 0 ; i < MAXHOSTS ; i++) {
        if ((id = profOrder[i]) == 0xff) {
            continue ;
        }
        sprintf(key, "HOST%02d", id) ;
        len = sizeof(HOSTREC) ;
        stat = PrfQueryProfileData(hini,
                    ProgramName, key, &profHosts[id], &len) ;
        if (stat != TRUE || len != sizeof(HOSTREC)) {
            PrfCloseProfile(hini) ;
            memset(profOrder, 0xff, sizeof(profOrder)) ;

#ifdef DEBUG
            TRACE("loadProfile - failed to read Host Data %d\n", id) ;
#endif

            return FALSE ;
        }
    }
    PrfCloseProfile(hini) ;

    /*
     * modified with command line arguments
     */

    for (i = 0 ; i < MAXHOSTS ; i++) {
        if ((id = profOrder[i]) == 0xff) {
            continue ;
        }
        if (argFormat32) {
            profHosts[id].format = PIXFMT_32 ;
        }
        if (argFormat8) {
            profHosts[id].format = PIXFMT_8 ;
        }
        if (argFormatTiny) {
            profHosts[id].format = PIXFMT_TINY ;
        }
        if (argFormatGray) {
            profHosts[id].format = PIXFMT_GRAY ;
        }
        if (argEncodeRaw) {
            profHosts[id].encode = rfbEncodingRaw ;
        }
        if (argEncodeRre) {
            profHosts[id].encode = rfbEncodingRRE ;
        }
        if (argEncodeCor) {
            profHosts[id].encode = rfbEncodingCoRRE ;
        }
        if (argEncodeHex) {
            profHosts[id].encode = rfbEncodingHextile ;
        }
        if (argOptShared) {
            profHosts[id].shared = TRUE ;
        }
        if (argOptViewonly) {
            profHosts[id].viewonly = TRUE ;
        }
        if (argOptDeiconify) {
            profHosts[id].deiconify = TRUE ;
        }
    }

    /*
     * also modify current session parameters
     */

    if (argServer) {
        strcpy(SessServerName, argServer) ;
    }
    if (argFormat32) {
        SessPixelFormat = PIXFMT_32 ;
    }
    if (argFormat8) {
        SessPixelFormat = PIXFMT_8 ;
    }
    if (argFormatTiny) {
        SessPixelFormat = PIXFMT_TINY ;
    }
    if (argFormatGray) {
        SessPixelFormat = PIXFMT_GRAY ;
    }
    if (argEncodeRaw) {
        SessPreferredEncoding = rfbEncodingRaw ;
    }
    if (argEncodeRre) {
        SessPreferredEncoding = rfbEncodingRRE ;
    }
    if (argEncodeCor) {
        SessPreferredEncoding = rfbEncodingCoRRE ;
    }
    if (argEncodeHex) {
        SessPreferredEncoding = rfbEncodingHextile ;
    }
    if (argOptShared) {
        SessOptShared = TRUE ;
    }
    if (argOptViewonly) {
        SessOptViewonly = TRUE ;
    }
    if (argOptDeiconify) {
        SessOptDeiconify = TRUE ;
    }

#ifdef DEBUG
    TRACE("loadProfile ... done\n") ;
#endif

    return TRUE ;
}
// Поток приложения вызывает WindowProc всякий раз, когда для окна есть сообщение.
// Window - окно, Message - сообщение, *_parameter - данные, которые передаются вместе с сообщением.
MRESULT EXPENTRY Keyboard_Break_WndProc( HWND Window, ULONG Message, MPARAM First_parameter, MPARAM Second_parameter )
{
 // Указатель на страницу.
 PPAGE Page = Enhancer.Pages.Keyboard_break;

 // Проверяем сообщение.
 switch( Message )
  {
   // Отображаем настройки.
   case SM_SHOW_SETTINGS:
    {
     BYTE Value = 0; if( Controller.Settings.Suppress_CtrlAltDel ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Break.Settings.CAD_button_ID, BM_SETCHECK, MPFROMLONG( Value ), 0 );

     Value = 0; if( Controller.Settings.Suppress_CtrlBreak ) Value = 1;
     WinSendDlgItemMsg( Window, Keyboard_Break.Settings.CB_button_ID, BM_SETCHECK, MPFROMLONG( Value ), 0 );
    }
   return 0;

   // Следим за полями ввода.
   case WM_CONTROL:
    {
     ULONG WM_Control_Window_ID = SHORT1FROMMP( First_parameter );
     ULONG WM_Control_Action_ID = SHORT2FROMMP( First_parameter );

     if( WM_Control_Window_ID == Keyboard_Break.Settings.CAD_button_ID )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Controller.Settings.Suppress_CtrlAltDel = 0;
           else Controller.Settings.Suppress_CtrlAltDel = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }

     if( WM_Control_Window_ID == Keyboard_Break.Settings.CB_button_ID )
      {
       switch( WM_Control_Action_ID )
        {
         case BN_CLICKED:
         case BN_DBLCLICKED:
          {
           ULONG Button_is_checked = (ULONG) WinSendDlgItemMsg( Window, WM_Control_Window_ID, BM_QUERYCHECK, 0, 0 );

           if( Button_is_checked ) Controller.Settings.Suppress_CtrlBreak = 0;
           else Controller.Settings.Suppress_CtrlBreak = 1;

           WinSendMsg( Window, SM_SHOW_SETTINGS, 0, 0 );
          }
         break;
        }
      }
    }
   return 0;

   // Обрабатываем нажатия на кнопки.
   case WM_COMMAND:
    {
     ULONG WM_Control_Button_ID = SHORT1FROMMP( First_parameter );

     if( WM_Control_Button_ID == OK_BUTTON_ID )
      {
       CHAR Settings_file_name[ SIZE_OF_PATH ] = ""; GetSettingsFileName( Settings_file_name );
       HINI Ini_file = OpenIniProfile( Enhancer.Application, Settings_file_name );

       if( Ini_file )
        {
         PrfWriteProfileData( Ini_file, "Settings", "Suppress Ctrl+Alt+Del", &Controller.Settings.Suppress_CtrlAltDel, sizeof( BYTE ) );
         PrfWriteProfileData( Ini_file, "Settings", "Suppress Ctrl+Break", &Controller.Settings.Suppress_CtrlBreak, sizeof( BYTE ) );

         PrfCloseProfile( Ini_file );

         BroadcastRSMessages();
         NiceReadSettings();
        }
      }

     if( WM_Control_Button_ID == PD_BUTTON_ID )
      {
       if( Page->SetDefSettings ) Page->SetDefSettings( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext1 ) Page->SetDefSettings_Ext1( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext2 ) Page->SetDefSettings_Ext2( Page->Settings_to_show );
       if( Page->SetDefSettings_Ext3 ) Page->SetDefSettings_Ext3( Page->Settings_to_show );

       WinPostMsg( Window, WM_COMMAND, (MPARAM) OK_BUTTON_ID, 0 );
      }

     if( WM_Control_Button_ID == HP_BUTTON_ID )
      {
       Help( Page->Settings_to_show, Enhancer.Code_page );
      }
    }
   return 0;
  }

 // Возврат.
 return WinDefWindowProc( Window, Message, First_parameter, Second_parameter );
}