TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: Detlef Engert
date: 1996-05-11 18:33:52
subject: profile

Hello Peter!

Thus quoth Peter Fitzsimmons to Francois Thunus:
 PF> They will always work (for OS/2 1.2+;  OS/2 1.1 used a different name
 PF> for the functions, such as WinQueryProfileData()).
 PF> The Prf api's don't even need PM to be running,  even though they are
 PF> in PMSHAPI.DLL (now forwared to pmmerge.dll).

If you rely on this you're in trouble. According to my experience PM must
be initialized to use this API. I check this in my programs:

#define INCL_DOSMODULEMGR
#include 

int main () {
  HMODULE hmod;
  PFN _PrfQueryProfileString;
  APIRET rc;
  char Buffer[100];

  /* If PM is initialized, PM shell API is known in the *system* */
  rc = DosQueryModuleHandle ("PMSHAPI", &hmod);
  printf ("Module: %lX (rc=%ld)\n", hmod, rc);
  if (rc != 0) return (1);

  /* ok - API is available, now activate the API in this *process* */
  rc = DosLoadModule (Buffer, sizeof(Buffer), "PMSHAPI", &hmod);
  printf ("Module: %lX (rc=%ld)\n", hmod, rc);
  if (rc != 0) return (2);

  /* done - now we can ask for the functions needed */
  rc = DosQueryProcAddr (hmod, 115, NULL, &_PrfQueryProfileString);
  printf ("ProcAddr: %lX (rc=%ld)\n", _PrfQueryProfileString, rc);
  if (rc != 0) return (3);

  _PrfQueryProfileString (HINI_USERPROFILE, "PM_INSTALL",
"MEDIA",
			  "bogus", Buffer, sizeof(Buffer));
  Buffer[sizeof(Buffer) - 1] = '\0';
  printf (Buffer);

  return (0);
}

If you don't test but use simple Prf* calls your VIO process will hang if
PM is not initialized. You may check this out by a simple boot to command
line!

bye, Detlef

 ! mailto dengert{at}medav.de, 2:2490/2576.1{at}fidonet
--- Sqed/32 1.10/r00108
* Origin: Nachtigall/2|Nuernberg/Ger|+49-911-861319|Z19+ISDN (2:2490/2575.2)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 2490/2575 2580 2001 24/999 888 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.