Changeset 10277 for trunk/src


Ignore:
Timestamp:
Oct 20, 2003, 7:18:30 PM (22 years ago)
Author:
sandervl
Message:

PF: migrate windows fonts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/inituser32.cpp

    r10256 r10277  
    1 /* $Id: inituser32.cpp,v 1.14 2003-10-02 10:35:59 sandervl Exp $ */
     1/* $Id: inituser32.cpp,v 1.15 2003-10-20 17:18:30 sandervl Exp $ */
    22/*
    33 * USER32 DLL entry point
     
    2929#define  INCL_DOSMISC
    3030#define  INCL_DOSERRORS
     31#define  INCL_WINSHELLDATA
    3132#include <os2wrap.h>    //Odin32 OS/2 api wrappers
    3233#include <stdlib.h>
     
    6768DWORD hInstanceUser32 = 0;
    6869
     70extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...);
    6971
    7072/**************************************************************/
     
    9294   strcpy(PMKBDHK_MODULE, pszKbdDllName);
    9395}
     96
     97#define FONTSDIRECTORY "Fonts"
     98#define REGPATH "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
     99
     100//******************************************************************************
     101//******************************************************************************
     102void MigrateWindowsFonts()
     103{
     104  HKEY  hkFonts,hkOS2Fonts;
     105  char  buffer[512];
     106  UINT  len = GetWindowsDirectoryA( NULL, 0 );
     107 
     108  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, REGPATH ,0, KEY_ALL_ACCESS, &hkFonts) == 0)
     109  {
     110      DWORD dwIndex, dwType;
     111      char subKeyName[255], dataArray[512];
     112      DWORD sizeOfSubKeyName = 254, sizeOfDataArray = 511;
     113
     114      // loop over all values of the current key
     115      for (dwIndex=0;
     116           RegEnumValueA(hkFonts, dwIndex, subKeyName, &sizeOfSubKeyName, NULL, &dwType ,(LPBYTE)dataArray, &sizeOfDataArray) != ERROR_NO_MORE_ITEMS_W;
     117           ++dwIndex, sizeOfSubKeyName = 254, sizeOfDataArray = 511)
     118      {
     119         //Check OS/2 INI profile for font entry
     120         if (!PrfQueryProfileString(HINI_PROFILE, "PM_Fonts", dataArray,
     121                            NULL, (PVOID)subKeyName, (LONG)sizeof(subKeyName)))
     122         {
     123           HDIR          hdirFindHandle = HDIR_CREATE;
     124           FILEFINDBUF3  FindBuffer     = {0};     
     125           ULONG         ulResultBufLen = sizeof(FILEFINDBUF3);
     126           ULONG         ulFindCount    = 1;       
     127           APIRET        rc             = NO_ERROR;
     128
     129           dprintf(("Migrating font %s to OS/2",dataArray));
     130
     131           GetWindowsDirectoryA( buffer, len + 1 );
     132           wsnprintfA( buffer, sizeof(buffer), "%s\\%s\\%s", buffer, FONTSDIRECTORY, dataArray );
     133
     134           rc = DosFindFirst( buffer, &hdirFindHandle, FILE_NORMAL,&FindBuffer, ulResultBufLen, &ulFindCount, FIL_STANDARD);
     135
     136           //Check that file actaully exist
     137           if ( rc == NO_ERROR  && !(FindBuffer.attrFile & FILE_DIRECTORY))
     138           {
     139              PrfWriteProfileString(HINI_PROFILE,"PM_Fonts",dataArray, buffer);   
     140              DosFindClose(hdirFindHandle);
     141           }
     142        }
     143      }
     144      RegCloseKey(hkFonts);
     145  }
     146}
     147
    94148//******************************************************************************
    95149//******************************************************************************
     
    227281         //CB: initialize PM monitor driver
    228282         MONITOR_Initialize(&MONITOR_PrimaryMonitor);
     283
     284         //PF: migrate windows fonts
     285         MigrateWindowsFonts();
    229286
    230287         break;
Note: See TracChangeset for help on using the changeset viewer.