コード例 #1
0
ファイル: PROFILE.CPP プロジェクト: OS2World/APP-CLOCK-Clock
static MRESULT APIENTRY OK ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {

 /***************************************************************************
  * Find the instance data.                                                 *
  ***************************************************************************/

  PPROFILE_PARMS Parms = PPROFILE_PARMS ( WinQueryWindowPtr ( hwnd, QWL_USER ) ) ;

 /***************************************************************************
  * Verify the entered path.                                                *
  ***************************************************************************/

  BYTE Name [256] ;
  WinQueryDlgItemText ( hwnd, Parms->id+ENTRY, sizeof(Name), Name ) ;

  BYTE FullPath [256] ;
  if ( DosQueryPathInfo ( Name, FIL_QUERYFULLNAME, FullPath, sizeof(FullPath) ) ) {
    PSZ Message = PSZ ( "ERROR: Not a valid path." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  FILESTATUS3 Status ;
  if ( DosQueryPathInfo ( FullPath, FIL_STANDARD, &Status, sizeof(Status) ) ) {
    PSZ Message = PSZ ( "ERROR: Path does not exist." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

  if ( ! ( Status.attrFile & FILE_DIRECTORY ) ) {
    PSZ Message = PSZ ( "ERROR: Specified path is not a directory." ) ;
    WinSetDlgItemText ( hwnd, Parms->id+ERR, Message ) ;
    WinAlarm ( HWND_DESKTOP, WA_ERROR ) ;
    WinSetFocus ( HWND_DESKTOP, WinWindowFromID ( hwnd, Parms->id+ENTRY ) ) ;
    return ( 0 ) ;
  }

 /***************************************************************************
  * Return the full path to the caller.                                     *
  ***************************************************************************/

  strncpy ( PCHAR(Parms->Path), PCHAR(FullPath), Parms->PathSize ) ;

 /***************************************************************************
  * Dismiss the dialog with a TRUE status.                                  *
  ***************************************************************************/

  WinDismissDlg ( hwnd, TRUE ) ;

  return ( 0 ) ;
}
コード例 #2
0
ファイル: char.cpp プロジェクト: srdgame/srdgame
size_t char_to_buf(char* buf, const RoCharInfoBase* info)
{
	if (buf == NULL || info == NULL)
		return 0;

	//printf("CHAR_TO_BUF, with name : %s\n", info->_name.c_str());
	size_t len = 0;
	PUINT32(buf, len) = info->_id;				len += 4;
	PUINT32(buf, len) = info->_exp._zeny;		len += 4;
	PUINT32(buf, len) = info->_exp._base_exp; 	len += 4;
	PUINT32(buf, len) = info->_exp._job_exp;	len += 4;
	PUINT32(buf, len) = info->_exp._job_lvl;	len += 4;
	PUINT32(buf, len) = 0;						len += 4;
	PUINT32(buf, len) = 0;						len += 4;
	PUINT32(buf, len) = info->_status._option;				len += 4;
	PUINT32(buf, len) = info->_prop._karma;		len += 4;
	PUINT32(buf, len) = info->_prop._manner;		len += 4;
	PUINT16(buf, len) = info->_exp._prop_point; 	len += 2;
	PUINT16(buf, len) = info->_prop._cur_hp;		len += 2;
	PUINT16(buf, len) = info->_prop._max_hp;		len += 2;
	PUINT16(buf, len) = info->_prop._cur_sp;		len += 2;
	PUINT16(buf, len) = info->_prop._max_sp;		len += 2;
	PUINT16(buf, len) = DEFAULT_WALK_SPEED;		len += 2;
	PUINT16(buf, len) = info->_class;				len += 2;
	PUINT16(buf, len) = info->_show._hair_style;			len += 2;
	PUINT16(buf, len) = info->_status._option & 0x20 ? 0 : info->_show._weapon;	len += 2; // when the weapon is sent and your option is riding, the client crashes on login!?
	PUINT16(buf, len) = info->_exp._base_lvl;		len += 2;
	PUINT16(buf, len) = info->_exp._skill_point;	len += 2;
	PUINT16(buf, len) = info->_show._head_bottom;	len += 2;
	PUINT16(buf, len) = info->_show._shield;		len += 2;
	PUINT16(buf, len) = info->_show._head_top;		len += 2;
	PUINT16(buf, len) = info->_show._head_middle;	len += 2;
	PUINT16(buf, len) = info->_show._hair_color;	len += 2;
	PUINT16(buf, len) = info->_show._clothes_color;	len += 2;
	memset(PCHAR(buf, len), 0, 24);
	memcpy(PCHAR(buf, len), info->_name.c_str(), min((int)info->_name.length(), 24)); len += 24;
	PUINT8(buf, len) = min(info->_prop._str, 255);		len += 1;
	PUINT8(buf, len) = min(info->_prop._agi, 255);		len += 1;
	PUINT8(buf, len) = min(info->_prop._vit, 255);		len += 1;
	PUINT8(buf, len) = min(info->_prop._int, 255);		len += 1;
	PUINT8(buf, len) = min(info->_prop._dex, 255);		len += 1;
	PUINT8(buf, len) = min(info->_prop._luk, 255);		len += 1;
	PUINT16(buf, len) = info->_slot;					len += 2;
	PUINT16(buf, len) = 1; 							len += 2;// Rename bit, 0 == rename, 1 == norename.
	assert(len == 108);
	return len;

}
コード例 #3
0
ファイル: process.cpp プロジェクト: 340211173/deianeira
//锁掉进程
//ulPID:目标进程ID
//返回:true:表示挂起成功,false:表示挂起失败
bool process_suspendProcess(ULONG ulPID)
{
	bool bRet = false;

	PNtQuerySystemInformation NtQuerySystemInformation;
	HMODULE hModule=LoadLibrary(L"ntdll.dll");
	if (hModule==NULL)
	{
		return false;
	}

	NtQuerySystemInformation=(PNtQuerySystemInformation)GetProcAddress(hModule, "NtQuerySystemInformation");
	if (NtQuerySystemInformation==NULL)
	{
		FreeLibrary(hModule);
		return false;
	}

	//枚举得到所有进程
	ULONG n = 0x100;
	PSYSTEM_PROCESSES sp = new SYSTEM_PROCESSES[n];

	while (NtQuerySystemInformation(
		SystemProcessesAndThreadsInformation,sp, n*sizeof(SYSTEM_PROCESSES), 0)
		== STATUS_INFO_LENGTH_MISMATCH)
	{
		delete[] sp;
		sp = new SYSTEM_PROCESSES[n = n * 2];
	}

	bool done = false;

	//遍历进程列表
	for (PSYSTEM_PROCESSES p = sp; !done;
		p = PSYSTEM_PROCESSES(PCHAR(p) + p->NextEntryDelta))
	{
		if (p->ProcessId==ulPID)
		{
			SYSTEM_THREADS systemThread=p->Threads[0];
			if (systemThread.dwState==5 && systemThread.dwWaitReason!=5)
			{
				HANDLE hThread=OpenThread(THREAD_ALL_ACCESS,FALSE,systemThread.ClientId.ulTID); 
				if(!SuspendThread(hThread))
				{
					bRet = true;
				}
				else
				{
					bRet = false;
				}
				CloseHandle(hThread); 
			}
		}
		done = p->NextEntryDelta == 0;
	}

	delete[] sp; 
	FreeLibrary(hModule);
	return bRet;
}
コード例 #4
0
ファイル: login.cpp プロジェクト: srdgame/srdgame
size_t from_admin_login(Packet* dest, const char* src,  size_t size)
{
	if (size < 2)
		return 0;

	AdminLoginInfo info;
	memset(info.pass, 0, 32);

	info.crypto_type  = (int)PUINT16(src, 2);
	const char* pass = PCHAR(src, 4);

	if (info.crypto_type == 0)
	{
		if (size < 28)
			return 0;
		memcpy(info.pass, pass, 24);
	}
	else
	{
		if (size < 20)
			return 0;
		memcpy(info.pass, pass, 16);
	}
	size_t res = (info.crypto_type == 0) ? 28 : 20;
	dest->op = EC_ADMIN_LOGIN;
	dest->len = sizeof(Packet) + sizeof(AdminLoginInfo);
	char * buf = new char[sizeof(AdminLoginInfo)];
	memcpy(buf, (char*)&info, sizeof(AdminLoginInfo));
	return res;
}
コード例 #5
0
extern BOOL VerifyDateFormat ( HWND hwndField, HWND hwndError, HWND hwndSample, char *DateFormat ) {

  /**************************************************************************
   * Get the new value.                                                     *
   **************************************************************************/

   char Local [100] ;
   Sys_GetWindowText ( hwndField, Local, sizeof(Local) ) ;
   GeneralDateFormat ( DateFormat, Local ) ;

  /**************************************************************************
   * Validate it.                                                           *
   **************************************************************************/

   char Result [100] ;
   if ( FormatDate ( time(0), DateFormat, Result, sizeof(Result) ) ) {
      Sys_SetWindowText ( hwndSample, Result ) ;
   } else {
      ResourceString Message ( LibraryHandle, IDS_DATEFMT_ERROR1 ) ;
      Sys_SetWindowText ( hwndError, PCHAR(Message) ) ;
      Sys_BeepError ( ) ;
      Sys_SetFocus ( hwndField ) ;
      return ( FALSE ) ;
   } /* endif */

  /**************************************************************************
   * Return no error.                                                       *
   **************************************************************************/

   return ( TRUE ) ;
}
コード例 #6
0
extern char *FormatDate ( time_t Time, char *Format, char *Buffer, int BufferSize ) {

   // Get the local time and date.
   struct tm Tm ;
   memcpy ( &Tm, localtime(&Time), sizeof(Tm) ) ;

   // Process the format string from start to finish.
   char *Source = Format ;
   char *Destination = Buffer ;

   while ( *Source AND ( Destination-Buffer < BufferSize ) ) {
      if ( *Source == Functions[DATEFN_HEADER][0] ) {
         Source ++ ;
         if ( *Source == Functions[DATEFN_YEAR4][0] ) {
            sprintf ( Destination, "%04i", Tm.tm_year+1900 ) ;
         } else if ( *Source == Functions[DATEFN_YEAR2][0] ) {
            sprintf ( Destination, "%02i", Tm.tm_year % 100  ) ;
         } else if ( *Source == Functions[DATEFN_MON][0] ) {
            sprintf ( Destination, "%0.*s", strlen(PCHAR(*Months))/12, PSZ(*Months) + Tm.tm_mon * (strlen(PCHAR(*Months))/12) ) ;
         } else if ( *Source == Functions[DATEFN_MONTH][0] ) {
            sprintf ( Destination, "%i", Tm.tm_mon+1 ) ;
         } else if ( *Source == Functions[DATEFN_MONTHS][0] ) {
            strcpy ( Destination, MonthNames[Tm.tm_mon] ) ;
         } else if ( *Source == Functions[DATEFN_DAY][0] ) {
            sprintf ( Destination, "%i", Tm.tm_mday ) ;
         } else if ( *Source == Functions[DATEFN_WEEKDAY][0] ) {
            strcpy ( Destination, WeekdayNames[Tm.tm_wday] ) ;
         } else if ( *Source == Functions[DATEFN_WKDAY][0] ) {
            sprintf ( Destination, "%0.*s", strlen(PCHAR(*Weekdays))/7, PSZ(*Weekdays) + Tm.tm_wday * (strlen(PCHAR(*Weekdays))/7) ) ;
         } else {
            *Destination++ = Functions[DATEFN_HEADER][0] ;
            *Destination++ = *Source ;
            *Destination = 0 ;
         } /* endif */
         Destination += strlen(Destination) ;
      } else {
         *Destination++ = *Source ;
      } /* endif */
      Source ++ ;
   } /* endwhile */

   // Null terminate the result.
   *Destination = 0 ;

   // Return the address of the formatted date.
   return ( Buffer ) ;
}
コード例 #7
0
ファイル: process.cpp プロジェクト: 340211173/deianeira
//获取进程的状态
//ulPID:目标进程ID
//返回:0:表示发生异常,1:表示进程处于挂起状态,2:表示进程没有被挂起
ULONG process_getProcessState(ULONG ulPID)
{
	PNtQuerySystemInformation NtQuerySystemInformation;
	HMODULE hModule=LoadLibrary(L"ntdll.dll");
	if (hModule==NULL)
	{
		return 0;
	}

	NtQuerySystemInformation=(PNtQuerySystemInformation)GetProcAddress(hModule, "NtQuerySystemInformation");
	if (NtQuerySystemInformation==NULL)
	{
		FreeLibrary(hModule);
		return 0;
	}

	//枚举得到所有进程
	ULONG n = 0x100;
	PSYSTEM_PROCESSES sp = new SYSTEM_PROCESSES[n];

	while (NtQuerySystemInformation(
		SystemProcessesAndThreadsInformation,sp, n*sizeof(SYSTEM_PROCESSES), 0)
		== STATUS_INFO_LENGTH_MISMATCH)
	{
		delete[] sp;
		sp = new SYSTEM_PROCESSES[n = n * 2];
	}

	bool done = false;

	//遍历进程列表
	for (PSYSTEM_PROCESSES p = sp; !done;
		p = PSYSTEM_PROCESSES(PCHAR(p) + p->NextEntryDelta))
	{
		if (p->ProcessId==ulPID)
		{
			SYSTEM_THREADS systemThread=p->Threads[0];
			if (systemThread.dwState==5 && systemThread.dwWaitReason==5)
			{
				delete[] sp; 
				FreeLibrary(hModule);
				//进程处于挂起状态
				return 1;
			}
			else
			{
				delete[] sp; 
				FreeLibrary(hModule);
				//进程没有被挂起
				return 2;
			}
		}
		done = p->NextEntryDelta == 0;
	}

	delete[] sp; 
	FreeLibrary(hModule);
	return 0;
}
コード例 #8
0
ファイル: login.cpp プロジェクト: srdgame/srdgame
size_t to_get_loginserver_info(char* buf, const Packet* packet)
{
	LoginServerInfo * info = (LoginServerInfo*)packet->param.Data;
	size_t res = 10;
	PUINT16(buf, 0) = 0x7531;
	memcpy(PCHAR(buf, 2), info->info, 8);
	return res;
}
コード例 #9
0
ファイル: char.cpp プロジェクト: srdgame/srdgame
size_t to_select_char_ok(char* dest, const MapServerInfo& info)
{
	size_t len = 0;
	PUINT16(dest, len) = 0x71;					len += 2;
	PUINT32(dest, len) = info._char_id; 		len += 4;
	memcpy(PCHAR(dest, len), info._map_name, 16); 	len += 16;
	PUINT32(dest, len) = htonl(info._ip);		len += 4;
	PUINT16(dest, len) = ntows(htons(info._port));	len += 2;
	assert(len == 28);
	return len;
}
コード例 #10
0
ファイル: login.cpp プロジェクト: srdgame/srdgame
size_t to_crypto_key(char* buf, const Packet* packet)
{
	RO_MD5Key* key = (RO_MD5Key*)(packet->param.Data);
	size_t md5keylen = 16; // take the less one.
	size_t res = 4 + 12;
	
	PUINT16(buf, 0) = 0x01dc; // opcode.
	PUINT16(buf, 2) = res;
	memcpy(PCHAR(buf, 4), key->key, md5keylen);

	return res;
}
コード例 #11
0
ファイル: DDE.cpp プロジェクト: OS2World/UTIL-SYSTEM-MemSize
static PDDESTRUCT MakeDDEObject (
   HWND Destination,                    // -> Destination window
   PSZ Item,                            // -> Item name or NULL.
   USHORT Status,                       // Status flags.
   USHORT Format,                       // Data format
   PVOID Data,                          // -> Data or NULL.
   ULONG DataLen                        // Data length in bytes.
) {

   ULONG ItemLen = Item ? strlen(PCHAR(Item))+1 : 1 ;

   PDDESTRUCT pBlock ;
   if ( DosAllocSharedMem ( PPVOID(&pBlock), 0, sizeof(DDESTRUCT) + ItemLen + DataLen,
      PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE ) )
      return ( 0 ) ;

   pBlock->cbData = DataLen ;
   pBlock->fsStatus = Status ;
   pBlock->usFormat = Format ;
   pBlock->offszItemName = sizeof(DDESTRUCT) ;

   if ( DataLen AND Data )
      pBlock->offabData = USHORT ( sizeof(DDESTRUCT) + ItemLen ) ;
   else
      pBlock->offabData = 0 ;

   if ( Item )
      strcpy ( PCHAR(DDES_PSZITEMNAME(pBlock)), PCHAR(Item) ) ;
   else
      strcpy ( PCHAR(DDES_PSZITEMNAME(pBlock)), "" ) ;

   if ( Data )
      memcpy ( DDES_PABDATA(pBlock), Data, size_t(DataLen) ) ;

   PID pid ; TID tid ;
   WinQueryWindowProcess ( Destination, &pid, &tid ) ;
   DosGiveSharedMem( (PVOID)pBlock, pid, PAG_READ | PAG_WRITE) ;

   return ( pBlock ) ;
}
コード例 #12
0
int Profile::GetIniData ( PINIDATA IniData ) {

 /***************************************************************************
  * Get the window's current size and position.                             *
  ***************************************************************************/

  memset ( &IniData->Position, 0, sizeof(IniData->Position) ) ;
  IniData->fPosition = FALSE ;
  if ( GetItem ( "Position", &IniData->Position, sizeof(IniData->Position) ) ) 
     IniData->fPosition = TRUE ;

  if ( !IniData->fPosition ) {
     Reset ( "Position" ) ;
     Reset ( "AnchorCorner" ) ;
     Reset ( "fAnchorCorner" ) ;
  } /* endif */
  
 /***************************************************************************
  * If unable to get position, and profile is not the preferred one, then   *
  *   return TRUE, indicating profile fetch error.                          *
  ***************************************************************************/

  if ( NOT IniData->fPosition ) {
     if ( ( ProfileName[0] == 0 ) || strcmp ( Name, PROGRAM_NAME ) ) {
        #ifdef DEBUG
           Log ( "Profile::GetIniData: No position obtained with non-default INI handle/name." ) ;
        #endif // DEBUG
        return ( 1 ) ;
     } /* endif */
     #ifdef DEBUG
        Log ( "Profile::GetIniData: No position obtained with handle %08X.", Handle ) ;
     #endif // DEBUG
  } /* endif */

 /***************************************************************************
  * Set the default profile.                                                *
  ***************************************************************************/

  IniData->Reset ( ) ;

 /***************************************************************************
  * Go get the saved values for the above, if they are to be found.         *
  ***************************************************************************/

  for ( int i=0; i<sizeof(ProfileItems)/sizeof(ProfileItems[0]); i++ ) 
     GetItem ( ProfileItems[i].Name, PCHAR(IniData)+ProfileItems[i].Offset, ProfileItems[i].Size ) ;

  if ( IniData->FontNameSize[0] )
     IniData->fFontNameSize = TRUE ;

  return ( 0 ) ;
}
コード例 #13
0
ファイル: DDE.cpp プロジェクト: OS2World/UTIL-SYSTEM-MemSize
void Dde_Application::Initiate ( HWND Owner, HWND Client, PDDEINIT pDdeInit, CONVCONTEXT &Conv ) {

   // If not for this application, hold your peace.
   if ( pDdeInit->pszAppName AND *pDdeInit->pszAppName AND strcmpi ( PCHAR(pDdeInit->pszAppName), Name ) )
      return ;

   // Pass the initiate request to each of the topics.
   Dde_Topic *Topic = First ;
   while ( Topic ) {
      Topic->Initiate ( Owner, Client, pDdeInit, Conv, Name ) ;
      Topic = Topic->QueryNext() ;
   } /* endwhile */
}
コード例 #14
0
ファイル: wndobj.cpp プロジェクト: UIKit0/Chicken-Tournament
CWnd::CWnd(const LPDIRECTDRAW7 vlpDD,const int vx,const int vy,const int vw,const int vh,CWnd* vowner,const int vcommand)
:x(vx),y(vy),w(vw),h(vh),owner(vowner),childwindow(NULL),closed(FALSE),returnvalue(0),canfocus(TRUE),lpDD(vlpDD?vlpDD:vowner->lpDD),focused(FALSE),command(vcommand)
{
	title=PCHAR(malloc(3));
	title[0]='\0';

	for (int i=0;i<MAX_CHILD;i++)child[i]=NULL;

	if (owner!=NULL) if (owner->GetFocusedChild()==-1)focused=TRUE;
	Invalidate();

	surf=CreateSurface(lpDD,w,h);

}
コード例 #15
0
ファイル: char.cpp プロジェクト: srdgame/srdgame
size_t chars_to_buf(char* buf, const RoCharInfoBase* infos, size_t num)
{
	size_t len = 0;
	PUINT16(buf, len) = 0x6b; 		len += 4;// will wirte another 2 bytes later.
	memset(PCHAR(buf, len), 0, 20); len += 20;// unknown.
	for (size_t i = 0; i < num; ++i)
	{
		len += char_to_buf(buf + len, infos + i);
	}
	assert(len == 24 + num * 108);
	PUINT16(buf, 2) = len;
	return len;
	//return 24 + 9 * 108;
}
コード例 #16
0
ファイル: printf.c プロジェクト: LGTMCU/f32c
__attribute__((optimize("-Os"))) static int
pd(void(*func)(int, void *), void *arg, double x)
{
	double tx, one = 1.0, integ = 0, lim = 0.00000000001;
	char cb[128]; /* XXX hardcoded buffer size on stack - revisit!!! */
	int first = 0, last = 0, retval = 0, i, t;

	if (x == 0) {
		PCHAR('0');
		return(retval);
	}

	if (x < 0) {
		x = -x;
		PCHAR('-');
	}

	if (x < one) {
		PCHAR('0');
	} else {
		for (tx = x; tx >= one; tx /= 10, lim *= 10) {
			i = tx;
			i %= 10;
			cb[last++] = '0' + i;
		}
		if (last > first)
			last--;
		for (i = 0; i < (last - first + 1) / 2; i++) {
			t = cb[first + i];
			cb[first + i] = cb[last - i];
			cb[last - i] = t;
		}
		for (i = first; i <= last; i++) {
			PCHAR(cb[i]);
			integ = integ * 10 + (cb[i] - '0');
		}
		x = x - integ;
		if (x < lim)
			return(retval);
	}

	tx = x;
	PCHAR('.');
	while (integ == 0 || x > lim) {
		tx = tx * 10.0;
		x = x / 10.0;
		i = tx;
		if (integ == 0 && i == 0)
			lim /= 100;
		else
			integ = 1;
		PCHAR('0' + (i % 10));
	}
	return(retval);
}
コード例 #17
0
ファイル: process.cpp プロジェクト: 340211173/deianeira
//获得进程线程列表
PSYSTEM_PROCESSES GetThreadList(ULONG ulPID) 
{ 
	PNtQuerySystemInformation NtQuerySystemInformation;
	HMODULE hModule=LoadLibrary(L"ntdll.dll");
	if (hModule==NULL)
	{
		return NULL;
	}

	NtQuerySystemInformation=(PNtQuerySystemInformation)GetProcAddress(hModule, "NtQuerySystemInformation");
	if (NtQuerySystemInformation==NULL)
	{
		FreeLibrary(hModule);
		return NULL;
	}

	//枚举得到所有进程
	ULONG n = 0x100;
	PSYSTEM_PROCESSES sp = new SYSTEM_PROCESSES[n];

	while (NtQuerySystemInformation(
		SystemProcessesAndThreadsInformation,sp, n*sizeof(SYSTEM_PROCESSES), 0)
		== STATUS_INFO_LENGTH_MISMATCH)
	{
		delete[] sp;
		sp = new SYSTEM_PROCESSES[n = n * 2];
	}

	bool done = false;

	//遍历进程列表
	for (PSYSTEM_PROCESSES p = sp; !done;
		p = PSYSTEM_PROCESSES(PCHAR(p) + p->NextEntryDelta))
	{
		if (p->ProcessId==ulPID) 
		{            
			FreeLibrary(hModule);
			//返回列表
			return p;
		} 
		done = p->NextEntryDelta == 0; 
	}

	return NULL;
}
コード例 #18
0
ファイル: bon_io.cpp プロジェクト: azat-archive/bonnie
CFileOp::CFileOp(int threadNum, CFileOp *parent)
 : Thread(threadNum, parent)
 , m_timer(parent->m_timer)
 , m_file_size(parent->m_file_size)
 , m_fd(-1)
 , m_isopen(false)
 , m_name(PCHAR(malloc(strlen(parent->m_name) + 5)))
 , m_sync(parent->m_sync)
#ifdef O_DIRECT
 , m_use_direct_io(parent->m_use_direct_io)
#endif
 , m_chunk_bits(parent->m_chunk_bits)
 , m_chunk_size(parent->m_chunk_size)
 , m_total_chunks(parent->m_total_chunks)
 , m_buf(new char[m_chunk_size])
{
  strcpy(m_name, parent->m_name);
}
コード例 #19
0
ファイル: char.cpp プロジェクト: srdgame/srdgame
size_t from_delete_char(DeleteCharData& data, const char* src, size_t src_len)
{
	if (src_len < 2)
		return 0;
	size_t len = 0;
	uint16 op = PUINT16(src, len);			len += 2;
	if (op == 0x68 && src_len < 46)
		return 0;
	if (op == 0x1fb && src_len < 56)
		return 0;

	data._id = PUINT32(src, len);			len += 4;
	memcpy(data._email, PCHAR(src, len), 40); 	len += 40;

	if (op == 0x68)
		return 46;
	if (op == 0x1fb)
		return 56;
}
コード例 #20
0
ファイル: login.cpp プロジェクト: srdgame/srdgame
size_t to_server_list_result(char* buf, const Packet* packet)
{
	ServerListHeader* header = (ServerListHeader*)packet->param.Data;
	uint16 count = header->server_count;
	size_t res = 47 + 32 * count;
	memset(buf, 0, res);

	PUINT16(buf, 0) = 0x69; // opcode.
	PUINT16(buf, 2) = res; // length :-)

	uint32 id1 = header->id1;
	uint32 id2 = header->id2;
	uint32 account = header->account;
	uint8 sex = header->sex;
	uint32 ip = header->ip;

	PUINT32(buf, 4) = id1;
	PUINT32(buf, 8) = account;
	PUINT32(buf, 12) = id2;
	PUINT32(buf, 16) = 0;

	PUINT16(buf, 44) = 0; // unknown
	PUINT8(buf, 46) = sex_str2num(sex);

	int i = 0;
	for (; i < count; ++i)
	{
		ServerInfo* info = (ServerInfo*)(packet->param.Data + sizeof(ServerListHeader) + sizeof(ServerInfo) * i);
		uint32 subnet_char_ip = lan_subnetcheck(ip);
		PUINT32(buf, 47 + i * 32) = htonl((subnet_char_ip) ? subnet_char_ip : info->ip);
		printf("IP of Server : %d.%d.%d.%d.\n", CONVIP(info->ip));
		printf("Port of Server : %d\n", info->port);

		PUINT16(buf, 47 + i * 32 + 4) = ntows(htons(info->port));

		memcpy(PCHAR(buf, 47 + i * 32 + 6), info->name, 20);
		PUINT16(buf, 47 + i * 32 + 26) = info->users;// users
		PUINT16(buf, 47 + i * 32 + 28) = info->maintenance; // maintenance
		PUINT16(buf, 47 + i * 32 + 30) = info->new_; // new_
	}
	return res;
}
コード例 #21
0
ファイル: DDE.cpp プロジェクト: OS2World/UTIL-SYSTEM-MemSize
Dde_Server::Dde_Server ( HAB Anchor, HMODULE Library, HWND Owner, char *AppName ) :
   Ready(FALSE), Application(AppName) {

   if ( !WinRegisterClass ( Anchor, PSZ(DDESERVER_CLASS),
      Dde_Processor, 0, sizeof(PVOID) ) ) {

      ERRORID Error = WinGetLastError ( Anchor ) ;
      ResourceString Title ( Library, IDS_TITLE ) ;
      ResourceString Format ( Library, IDS_ERROR_WINREGISTERCLASS ) ;
      CHAR Message [200] ;
      sprintf ( Message, PCHAR(Format), DDESERVER_CLASS, Error ) ;
      Log ( "%s", Message ) ;
      WinMessageBox ( HWND_DESKTOP, Owner, PSZ(Message),
         PSZ(Title), 0, MB_ENTER | MB_ICONEXCLAMATION ) ;
      return ;

   } /* endif */

   Ready = TRUE ;
}
コード例 #22
0
ファイル: inline_hook_dll.cpp プロジェクト: jujinesy/Combine
/**	---------------------------------------------------------------------------
	\brief	

		IncrementalLink 옵션을 사용해서 링크한 경우(DEBUG default)

		push argument
		call my_thread_proc
		...
		my_thread_proc :
		jmp RVA
		형태로 코드가 생성됨
		따라서 실제 구현코드는 jmp 인스트럭션 다음 4바이트값이다.
		
		IncrementalLink 옵션을 사용하지 않은 경우(RELEASE default)
		funcName 은 실제 func 의 body 부분임

	\param	
	\return			
	\code
	\endcode		
-----------------------------------------------------------------------------*/
DWORD_PTR get_function_body_address(void* FuncName)
{
	_ASSERTE(NULL != FuncName);
	if (NULL == FuncName){return 0;}

	DWORD_PTR dwRVA = 0;
	BYTE* tmp = (BYTE*) FuncName;
	if (0xe9 == tmp[0])
	{
		void *_tempFuncName = FuncName;
		char *ptempFuncName = PCHAR(_tempFuncName);	
		DWORD_PTR _jmpdwRVA = 0;
		CopyMemory(&_jmpdwRVA, ptempFuncName + 1, 4);
		dwRVA = (DWORD_PTR)ptempFuncName + _jmpdwRVA + 5;	
	}
	else
	{
		dwRVA = (DWORD_PTR)FuncName;
	}
	return (dwRVA);
}
コード例 #23
0
ファイル: DDE.cpp プロジェクト: OS2World/UTIL-SYSTEM-MemSize
void Dde_Topic::Initiate ( HWND Owner, HWND Client, PDDEINIT pDdeInit, CONVCONTEXT &Conv, char *AppName ) {

   // If not for this topic, hold your peace.
   if ( pDdeInit->pszTopic AND *pDdeInit->pszTopic AND strcmpi ( PCHAR(pDdeInit->pszTopic), Name ) )
      return ;

   // Find an empty slot in the server list.
   for ( int i=0; i<sizeof(Servers)/sizeof(Servers[0]); i++ ) 
      if ( Servers[i] == 0 ) 
         break ;
   if ( i >= sizeof(Servers)/sizeof(Servers[0]) ) 
      return ;

   // Create the server window and add it to the list.
   DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) malloc ( sizeof(DDESERVER_PARMS) ) ;
   Parms->Client = Client ;
   Parms->Topic = this ;
   Servers[i] = WinCreateWindow ( HWND_OBJECT, PSZ(DDESERVER_CLASS),
      0, 0, 0, 0, 0, 0, Owner, HWND_TOP, 0, Parms, 0 ) ;

   // Respond to the request.
   WinDdeRespond ( Client, Servers[i], PSZ(AppName), PSZ(Name), &Conv ) ;
}
コード例 #24
0
static MRESULT APIENTRY InitDlg ( HWND Window, MESG msg, MPARAM1 mp1, MPARAM2 mp2 ) {

  /**************************************************************************
   * Get parameters from initialization message.                            *
   **************************************************************************/

   PTABS_PARMS Parms = PTABS_PARMS ( PVOIDFROMMP ( mp2 ) ) ;

   Sys_SetWindowData ( Window, Parms ) ;

  /**************************************************************************
   * Set the current measurement units.                                     *
   **************************************************************************/

   ResourceString English ( Parms->Library, IDS_UNITS_ENGLISH ) ;
   ResourceString Metric ( Parms->Library, IDS_UNITS_METRIC ) ;

   Sys_SetWindowText ( CHILD(Window,IDD_TABS_UNITS), Parms->Metric ? PSZ(Metric) : PSZ(English) ) ;

  /**************************************************************************
   * Set the page size.                                                     *
   **************************************************************************/

   ResourceString Margins ( Parms->Library, IDS_TABS_MARGINS ) ;
   char String1 [20] ;  FormatDecimal ( String1, Parms->LeftMargin, 1000, 3 ) ;
   char String2 [20] ;  FormatDecimal ( String2, Parms->RightMargin, 1000, 3 ) ;
   char Text [100] ;
   sprintf ( Text, PCHAR(Margins), String1, String2 ) ;
   Sys_SetWindowText ( CHILD(Window,IDD_TABS_SIZE), Text ) ;

  /**************************************************************************
   * Return no error.                                                       *
   **************************************************************************/

   return ( Dialog_Processor ( Window, msg, mp1, mp2 ) ) ;
}
コード例 #25
0
ファイル: char.cpp プロジェクト: srdgame/srdgame
size_t from_create_char(CreateCharData& data, const char* buf, size_t src_len)
{
	if (src_len < 37)
		return 0;
	assert(PUINT16(buf, 0) == 0x67);
	size_t len = 2;
	/*assert(sizeof(CreateCharData) == 35);
	::memcpy(data._name, src, 35); // Just copy it :-).
	*/
	memcpy(data._name, PCHAR(buf, len), MAX_NAME_LEN);	len += MAX_NAME_LEN;
	data._str = PUINT8(buf, len);				len += 1;
	data._agi = PUINT8(buf, len);				len += 1;
	data._vit = PUINT8(buf, len);				len += 1;
	data._int = PUINT8(buf, len);				len += 1;
	data._dex = PUINT8(buf, len);				len += 1;
	data._luk = PUINT8(buf, len);				len += 1;
	data._slot = PUINT8(buf, len); 				len += 1;// The slot index for select characters.... -_-!
	data._hair_color = PUINT16(buf, len);		len += 2;
	data._hair_style = PUINT16(buf, len);		len += 2;

	assert(len == 37);

	return 37;
}
コード例 #26
0
ファイル: bon_io.cpp プロジェクト: azat-archive/bonnie
int CFileOp::Open(CPCCHAR base_name, bool create)
{
  m_name = PCHAR(malloc(strlen(base_name) + 5));
  strcpy(m_name, base_name);
  return reopen(create);
}
コード例 #27
0
static MRESULT APIENTRY PresParamChanged ( HWND Window, MESG msg, MPARAM1 mp1, MPARAM2 mp2 ) {

  /**************************************************************************
   * Find the instance data.                                                *
   **************************************************************************/

   PDATA Data = PDATA ( Sys_GetWindowData ( Window ) ) ;

  /**************************************************************************
   * Get the presentation parameter that changed.                           *
   **************************************************************************/

   switch ( LONGFROMMP(mp1) ) {

     /***********************************************************************
      * If font, note the fact that we now have a font to be saved as       *
      *   part of the configuration.  Apply the font to the Main window.    *
      ***********************************************************************/

      case PP_FONTNAMESIZE: {
         if ( Data->SettingFont )
            break ;
         Data->SettingFont = TRUE ;
         ULONG ppid ;
         char Font [80] ;
         if ( WinQueryPresParam ( Window, PP_FONTNAMESIZE, 0, &ppid, sizeof(Font), PSZ(Font), 0 ) ) {
            if ( strcmpi ( Font, PCHAR(Data->IniData->RulerFont) ) ) {
               WinSetPresParam ( Data->MainWindow, PP_FONTNAMESIZE, strlen(Font)+1, PSZ(Font) ) ;
            } /* endif */
         } /* endif */
         Data->SettingFont = FALSE ;
         break ; }

     /***********************************************************************
      * If background color, note the fact and repaint the window.          *
      ***********************************************************************/

      case PP_BACKGROUNDCOLOR: {
         ULONG ppid ;
         if ( WinQueryPresParam ( Window, PP_BACKGROUNDCOLOR, 0, &ppid,
            sizeof(Data->IniData->RulerColors[0]), &Data->IniData->RulerColors[0], 0 ) ) {
            Data->IniData->fRulerColors[0] = TRUE ;
         } else {
            Data->IniData->RulerColors[0] = RGB_WHITE ;
            Data->IniData->fRulerColors[0] = FALSE ;
         } /* endif */
         Sys_InvalidateWindow ( Data->MainWindow ) ;
         break ; }

     /***********************************************************************
      * If foreground color, note the fact and repaint the window.          *
      ***********************************************************************/

      case PP_FOREGROUNDCOLOR: {
         ULONG ppid ;
         if ( WinQueryPresParam ( Window, PP_FOREGROUNDCOLOR, 0, &ppid,
            sizeof(Data->IniData->RulerColors[1]), &Data->IniData->RulerColors[1], 0 ) ) {
            Data->IniData->fRulerColors[1] = TRUE ;
         } else {
            Data->IniData->RulerColors[1] = RGB_BLUE ;
            Data->IniData->fRulerColors[1] = FALSE ;
         } /* endif */
         Sys_InvalidateWindow ( Data->MainWindow ) ;
         break ; }

   } /* endswitch */

  /**************************************************************************
   * Return through the default processor, letting window activation        *
   *   and other system functions occur.                                    *
   **************************************************************************/

   return ( Sys_DefWindowProc ( Window, msg, mp1, mp2 ) ) ;
}
コード例 #28
0
ファイル: DDE.cpp プロジェクト: OS2World/UTIL-SYSTEM-MemSize
extern MRESULT APIENTRY Dde_Processor ( HWND Server, ULONG Msg, MPARAM mp1, MPARAM mp2 ) {

   switch ( Msg ) {

      case WM_CREATE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) mp1 ;
         WinSetWindowPtr ( Server, QWL_USER, Parms ) ;
         return ( 0 ) ; }

      case WM_DESTROY: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         Parms->Topic->Terminate ( Server, Parms->Client, FALSE ) ;
         return ( 0 ) ; }

      case WM_DDE_REQUEST: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         HWND Client = HWNDFROMMP ( mp1 ) ;
         PDDESTRUCT Request = PDDESTRUCT ( mp2 ) ;
         PCHAR Item = PCHAR ( DDES_PSZITEMNAME ( Request ) ) ;
         Parms->Topic->Request ( Server, Client, Item ) ;
         DosFreeMem ( Request ) ;
         return ( 0 ) ; }

      case WM_DDE_POKE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         HWND Client = HWNDFROMMP ( mp1 ) ;
         PDDESTRUCT Request = PDDESTRUCT ( mp2 ) ;
         PCHAR Item = PCHAR ( DDES_PSZITEMNAME ( Request ) ) ;
         int Format = int ( Request->usFormat ) ;
         PVOID Data = PVOID ( DDES_PABDATA ( Request ) ) ;
         int Size = int ( Request->cbData ) ;
         Parms->Topic->Poke ( Server, Client, Item, Format, Data, Size ) ;
         DosFreeMem ( Request ) ;
         return ( 0 ) ; }

      case WM_DDE_ADVISE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         HWND Client = HWNDFROMMP ( mp1 ) ;
         PDDESTRUCT Request = PDDESTRUCT ( mp2 ) ;
         PCHAR Item = PCHAR ( DDES_PSZITEMNAME ( Request ) ) ;
         Parms->Topic->Advise ( Server, Client, Item, ! ( Request->fsStatus & DDE_FNODATA ) ) ;
         DosFreeMem ( Request ) ;
         return ( 0 ) ; }

      case WM_DDE_UNADVISE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         HWND Client = HWNDFROMMP ( mp1 ) ;
         PDDESTRUCT Request = PDDESTRUCT ( mp2 ) ;
         PCHAR Item = PCHAR ( DDES_PSZITEMNAME ( Request ) ) ;
         Parms->Topic->Unadvise ( Server, Client, Item ) ;
         DosFreeMem ( Request ) ;
         return ( 0 ) ; }

      case WM_DDE_EXECUTE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         HWND Client = HWNDFROMMP ( mp1 ) ;
         PDDESTRUCT Request = PDDESTRUCT ( mp2 ) ;
         PCHAR Item = PCHAR ( DDES_PSZITEMNAME ( Request ) ) ;
         int Format = int ( Request->usFormat ) ;
         PVOID Data = PVOID ( DDES_PABDATA ( Request ) ) ;
         int Size = int ( Request->cbData ) ;
         Parms->Topic->Execute ( Server, Client, Item, Format, Data, Size ) ;
         DosFreeMem ( Request ) ;
         return ( 0 ) ; }

      case WM_DDE_TERMINATE: {
         DDESERVER_PARMS *Parms = (DDESERVER_PARMS*) WinQueryWindowPtr ( Server, QWL_USER ) ;
         Parms->Topic->Terminate ( Server, Parms->Client, TRUE ) ;
         return ( 0 ) ; }

   } /* endswitch */

   return ( WinDefWindowProc ( Server, Msg, mp1, mp2 ) ) ;
}
コード例 #29
0
HRESULT CCeeGen::emitMetaData(IMetaDataEmit *emitter, CeeSection* section, DWORD offset, BYTE* buffer, unsigned buffLen)
{
    HRESULT hr = S_OK;

    ReleaseHolder<IStream> metaStream(NULL);
    
    IfFailRet((HRESULT)CreateStreamOnHGlobal(NULL, TRUE, &metaStream));
    
    if (! m_fTokenMapSupported) {
        IUnknown *pMapTokenIface;
        IfFailGoto(getMapTokenIface(&pMapTokenIface, emitter), Exit);

        // Set a callback for token remap and save the tokens which change.
        IfFailGoto(emitter->SetHandler(pMapTokenIface), Exit);
    }

    // generate the metadata
    IfFailGoto(emitter->SaveToStream(metaStream, 0), Exit);

    // get size of stream and get sufficient storage for it

    if (section == 0) {
        section = &getMetaSection();
        STATSTG statStg;
        IfFailGoto((HRESULT)(metaStream->Stat(&statStg, STATFLAG_NONAME)), Exit);

        buffLen = statStg.cbSize.u.LowPart;
        if(m_objSwitch)
        {
            CeeSection* pSect;
            DWORD flags = IMAGE_SCN_LNK_INFO | IMAGE_SCN_LNK_REMOVE | IMAGE_SCN_ALIGN_1BYTES; // 0x00100A00
            IfFailGoto(getSectionCreate(".cormeta",flags,&pSect,&m_metaIdx), Exit);
        }
        buffer = (BYTE *)section->getBlock(buffLen, sizeof(DWORD));
        IfNullGoto(buffer, Exit);
        offset = getMetaSection().dataLen() - buffLen;
    }
    else {
        _ASSERTE(buffer[buffLen-1] || true); // Dereference 'buffer'
        _ASSERTE(section->computeOffset(PCHAR(buffer)) == offset);
    }

    // reset seek pointer and read from stream
    {
        LARGE_INTEGER disp = { {0, 0} };
        IfFailGoto((HRESULT)metaStream->Seek(disp, STREAM_SEEK_SET, NULL), Exit);
    }
    ULONG metaDataLen;
    IfFailGoto((HRESULT)metaStream->Read(buffer, buffLen+1, &metaDataLen), Exit);

    _ASSERTE(metaDataLen <= buffLen);



    // Set meta virtual address to offset of metadata within .meta, and 
    // and add a reloc for this offset, which will get turned 
    // into an rva when the pewriter writes out the file. 

    m_corHeader->MetaData.VirtualAddress = VAL32(offset);
    getCorHeaderSection().addSectReloc(m_corHeaderOffset + offsetof(IMAGE_COR20_HEADER, MetaData), *section, srRelocAbsolute);
    m_corHeader->MetaData.Size = VAL32(metaDataLen);

Exit:
    
    if (! m_fTokenMapSupported) {
        // Remove the handler that we set
        hr = emitter->SetHandler(NULL);
    }

#ifdef _DEBUG
    if (FAILED(hr) && hr != E_OUTOFMEMORY)
        _ASSERTE(!"Unexpected Failure");
#endif
    
    return hr;
}
コード例 #30
0
ファイル: PROFILE.CPP プロジェクト: OS2World/APP-CLOCK-Clock
Profile::Profile
(
  PSZ     name,
  HAB     Anchor,
  HMODULE Library,
  int     DialogID,
  HWND    HelpInstance,
  BOOL    ResetFlag
) {

  /**************************************************************************
   * Save the names.                                                        *
   **************************************************************************/

   Name = new BYTE [ strlen(PCHAR(name)) + 1 ] ;
   strcpy ( PCHAR(Name), PCHAR(name) ) ;

  /**************************************************************************
   * If resetting the profile, clear the system profile information now.    *
   **************************************************************************/

   if ( ResetFlag ) {
      PrfWriteProfileData ( HINI_USERPROFILE, Name, PSZ(NULL), PSZ(NULL), 0 ) ;
   }

  /**************************************************************************
   * Query the system INI for the profile file's path.                      *
   **************************************************************************/

   PSZ ProfilePath = PSZ(NULL) ;
   ULONG Size ;

   if ( PrfQueryProfileSize ( HINI_USERPROFILE, Name, PSZ("INIPATH"), &Size ) ) {

      // The info exists.  Fetch it.
      ProfilePath = new BYTE [ Size ] ;
      PrfQueryProfileData ( HINI_USERPROFILE, Name,
         PSZ("INIPATH"), ProfilePath, &Size ) ;

      // Build the profile file name.
      BYTE FullPath [_MAX_PATH] ;
      strcpy ( PCHAR(FullPath), PCHAR(ProfilePath) ) ;
      strcat ( PCHAR(FullPath), "\\" ) ;
      strcat ( PCHAR(FullPath), PCHAR(Name) ) ;
      strcat ( PCHAR(FullPath), ".INI" ) ;

      // Clean the name up and expand it to a full path.
      BYTE Path [256] ;
      DosQueryPathInfo ( FullPath, FIL_QUERYFULLNAME, Path, sizeof(Path) ) ;

      // Does the file exist?  If not, discard the name.
      FILESTATUS3 Status ;
      if ( DosQueryPathInfo ( Path, FIL_STANDARD, &Status, sizeof(Status) ) ) {
         delete [] ProfilePath ;
         ProfilePath = PSZ(NULL) ;
      }
   }

  /**************************************************************************
   * If the profile file couldn't be found, ask the user for a path.        *
   **************************************************************************/

   if ( ProfilePath == NULL ) {
      // Set the default path.
      BYTE Path [256] ;
      DosQueryPathInfo ( PSZ("."), FIL_QUERYFULLNAME, Path, sizeof(Path) ) ;

      // Call up the entry dialog.
      PROFILE_PARMS Parms ;
      Parms.id = short ( DialogID ) ;
      Parms.hwndHelp = HelpInstance ;
      Parms.Path = Path ;
      Parms.PathSize = sizeof(Path) ;
      if ( WinDlgBox ( HWND_DESKTOP, HWND_DESKTOP, PFNWP(ProfileProcessor), Library, DialogID, &Parms ) ) {
         // If OK, save the approved path in the system profile.
         ProfilePath = new BYTE [ strlen(PCHAR(Path)) + 1 ] ;
         strcpy ( PCHAR(ProfilePath), PCHAR(Path) ) ;

         PrfWriteProfileData ( HINI_USERPROFILE, Name, PSZ("INIPATH"),
            ProfilePath, strlen(PCHAR(ProfilePath))+1 ) ;
      }
   }

  /**************************************************************************
   * Reset profile handle.  If the path could be determined . . .           *
   **************************************************************************/

   Handle = 0 ;

   if ( ProfilePath ) {

     /***********************************************************************
      * Build the full profile file name.                                   *
      ***********************************************************************/

      BYTE ProfileName [_MAX_PATH] ;
      strcpy ( PCHAR(ProfileName), PCHAR(ProfilePath) ) ;
      strcat ( PCHAR(ProfileName), "\\"  ) ;
      strcat ( PCHAR(ProfileName), PCHAR(Name) ) ;
      strcat ( PCHAR(ProfileName), ".INI" ) ;

     /***********************************************************************
      * Release the memory previously allocated to store the path.          *
      ***********************************************************************/

      if ( ProfilePath ) {
         delete [] ProfilePath ;
      }

     /***********************************************************************
      * Open/Create the profile file and return the resultant handle.       *
      ***********************************************************************/

      Handle = PrfOpenProfile ( Anchor, ProfileName ) ;

     /***********************************************************************
      * If resetting, then clean this profile out.                          *
      ***********************************************************************/

      if ( ResetFlag ) {
         PrfWriteProfileData ( Handle, Name, PSZ(NULL), PSZ(NULL), 0 ) ;
      }
   }
}