Example #1
0
//************************************
// Method:    GetUserProfileDir : Read in user profile directory
// FullName:  CAutoStartupInfo::GetUserProfileDir
// Access:    private
// Returns:   bool
// Qualifier: const
// Parameter: CString & csUserProfileDir_o
// Parameter: CString & csAllUserProfileDir_o
//************************************
bool CAutoStartupInfo::GetUserProfileDir( CString& csUserProfileDir_o,
        CString& csAllUserProfileDir_o ) const
{
    HANDLE hProcToken = 0;
    if( !OpenProcessToken( GetCurrentProcess(), TOKEN_READ, &hProcToken ))
    {
        TRACE_ERR( "Failed to open process token for accessing user profile directory" );
        return false;
    }// End if

    // Auto closes handle when out of scope
    Utils::AutoHandleMgr ahmHndlMgr( hProcToken );

    // Read in user profile directory
    DWORD dwProfileDirBuffLen = MAX_PATH;
    const BOOL bCurrUserResult = ::GetUserProfileDirectory( hProcToken,
                                 csUserProfileDir_o.GetBufferSetLength( dwProfileDirBuffLen ),
                                 &dwProfileDirBuffLen );
    csUserProfileDir_o.ReleaseBuffer();

    // Reset buffer length
    dwProfileDirBuffLen = MAX_PATH;

    // Read in all users profile directory
    const BOOL bAllUserResult = ::GetAllUsersProfileDirectory( csAllUserProfileDir_o.GetBufferSetLength( dwProfileDirBuffLen ),
                                &dwProfileDirBuffLen );
    csAllUserProfileDir_o.ReleaseBuffer();

    // Return status
    return ( bCurrUserResult != FALSE || bAllUserResult != FALSE );
}// End GetUserProfileDir
Example #2
0
void CSqlCursor::getExecutionPlan(CString& rPlan, int nMaxSize)
{
	ASSERT(isConnected());
	if (::sqlexp(*this, (SQLTDAP)rPlan.GetBufferSetLength(nMaxSize), (SQLTDAL)nMaxSize))
		THROW(new CSqlCsrException(*this));
	rPlan.ReleaseBuffer();		
}
Example #3
0
void CPatchListCtrl::OnDropFiles(HDROP hDropInfo)
{
	UINT nNumFiles = DragQueryFile(hDropInfo, 0xFFFFFFFF, nullptr, 0);
	for (UINT i = 0; i < nNumFiles; ++i)
	{
		CString file;
		DragQueryFile(hDropInfo, i, file.GetBufferSetLength(MAX_PATH), MAX_PATH);
		file.ReleaseBuffer();
		if (PathIsDirectory(file))
			continue;

		// no duplicates
		LVFINDINFO lvInfo;
		lvInfo.flags = LVFI_STRING;
		lvInfo.psz = file;
		if (FindItem(&lvInfo, -1) != -1)
			continue;

		int index = InsertItem(GetItemCount(), file);
		if (index >= 0)
			SetCheck(index, true);
	}
	DragFinish(hDropInfo);
	SetColumnWidth(0, LVSCW_AUTOSIZE);
}
Example #4
0
void SourceEdit::OpenFile(CFile* file)
{
  int utfLen = (int)file->GetLength();

  // Read in the file as UTF-8
  CString utfText;
  LPSTR utfPtr = utfText.GetBufferSetLength(utfLen);
  file->Read(utfPtr,utfLen);
  utfText.ReleaseBuffer(utfLen);

  // Check for a UTF-8 BOM
  if (utfText.GetLength() >= 3)
  {
    if (utfText.Left(3) == "\xEF\xBB\xBF")
      utfText = utfText.Mid(3);
  }

  CallEdit(SCI_SETTEXT,0,(sptr_t)(LPCSTR)utfText);
  CallEdit(SCI_EMPTYUNDOBUFFER);
  CallEdit(SCI_SETSAVEPOINT);

  CFileStatus status;
  if (file->GetStatus(status))
    m_fileTime = status.m_mtime;
}
Example #5
0
BOOL CUtils::IsWin8()
{
    static BOOL g_bFirst = TRUE;
    static BOOL g_bResult = FALSE;

    if (g_bFirst)
    {
        OSVERSIONINFO osif = { 0 };

        osif.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
        GetVersionEx(&osif);

        if(osif.dwMajorVersion == 6 && osif.dwMinorVersion == 2)
        {
            WCHAR szNtoskrnl[MAX_PATH] = {};
            SHGetSpecialFolderPath(NULL, szNtoskrnl, CSIDL_SYSTEM, FALSE);
            PathAppend(szNtoskrnl, L"ntoskrnl.exe");

            CString strVersion;
            CCommonAlgorithm::GetFileVer(szNtoskrnl, strVersion.GetBufferSetLength(256), strVersion.GetLength());
            strVersion.Trim();

            if (strVersion.Find(L"6.2") == 0)
            {
                g_bResult = TRUE;
            }
        }

        g_bFirst = FALSE;
    }

    return g_bResult;
}
Example #6
0
bool SourceEdit::SaveFile(CFile* file)
{
  // Get the contents of the document as UTF-8
  CallEdit(SCI_CONVERTEOLS,SC_EOL_LF);
  int len = (int)CallEdit(SCI_GETLENGTH);
  CString utfText;
  LPSTR utfPtr = utfText.GetBufferSetLength(len+1);
  CallEdit(SCI_GETTEXT,len+1,(sptr_t)utfPtr);
  utfText.ReleaseBuffer();

  // Write out the document contents
  bool success = true;
  try
  {
    file->Write(utfText,utfText.GetLength());
    CallEdit(SCI_SETSAVEPOINT);
  }
  catch (CException* ex)
  {
    ex->Delete();
    success = false;
  }

  CFileStatus status;
  if (file->GetStatus(status))
    m_fileTime = status.m_mtime;

  return success;
}
void CResizableLayout::AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR)
{
	CWnd* pParent = GetResizableWnd();

	// child window must be valid
	ASSERT(::IsWindow(hWnd));
	// must be child of parent window
//	ASSERT(::IsChild(pParent->GetSafeHwnd(), hWnd));
	// top-left anchor must be valid
	ASSERT(sizeTypeTL != NOANCHOR);

	// get control's window class
	CString sClassName;
	GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH);
	sClassName.ReleaseBuffer();

	// get parent window's rect
	CRect rectParent;
	GetTotalClientRect(&rectParent);
	// and child control's rect
	CRect rectChild;
	::GetWindowRect(hWnd, &rectChild);
	::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);

	// adjust position, if client area has been scrolled
	rectChild.OffsetRect(-rectParent.TopLeft());

	// go calculate margins
	CSize sizeMarginTL, sizeMarginBR;

	if (sizeTypeBR == NOANCHOR)
		sizeTypeBR = sizeTypeTL;
	
	// calculate margin for the top-left corner

	sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100;
	sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100;
	
	// calculate margin for the bottom-right corner

	sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100;
	sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100;

	// prepare the structure
	LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL,
		sizeTypeBR, sizeMarginBR, sClassName);

	// initialize resize properties (overridable)
	InitResizeProperties(layout);

	// must not be already there!
	// (this is probably due to a duplicate call to AddAnchor)
	POSITION pos;
	ASSERT(!m_mapLayout.Lookup(hWnd, pos));

	// add to the list and the map
	pos = m_listLayout.AddTail(layout);
	m_mapLayout.SetAt(hWnd, pos);
}
Example #8
0
//************************************
// Method:    GetAutoStartupApplicationPaths
// FullName:  CAutoStartupInfo::GetAutoStartupApplicationPaths
// Access:    private
// Returns:   bool
// Qualifier:
// Parameter: HKEY hKey_i
// Parameter: StringVector & KeyValues_io
//************************************
bool CAutoStartupInfo::GetAutoStartupApplicationPaths( const HKEY hKey_i )
{
    // Key name and key value buffers
    TCHAR szKeyNameBuff[MAX_PATH] = { 0 };
    DWORD dwKeyNameLength = MAX_PATH;

    for( DWORD dwIndex = 0;
            RegEnumValue( hKey_i, dwIndex, szKeyNameBuff, &dwKeyNameLength, 0, 0, 0, 0 ) == ERROR_SUCCESS;
            ++dwIndex )
    {
        CString csKeyValue;
        if( GetRegKeyStringValue( hKey_i, szKeyNameBuff, csKeyValue ))
        {
            if( IsEnvironmentVarPath( csKeyValue ))
            {
                // Get expanded path
                TCHAR szExpandedPath[MAX_PATH] = { 0 };
                ExpandEnvironmentStrings( csKeyValue, szExpandedPath, MAX_PATH );

                // Copy back to original buffer
                csKeyValue = szExpandedPath;
            }

            LPTSTR lptszKeyValueBuff = csKeyValue.GetBufferSetLength( csKeyValue.GetLength() + MAX_PATH );

            // If path is unquoted then quote, because PathRemoveArgs requires paths with spaces to
            // be quoted
            if( !_tcschr( lptszKeyValueBuff, _T( '\"' )))
            {
                PathQuoteSpaces( lptszKeyValueBuff );
            }

            // Remove command line arguments from path
            PathRemoveArgs( lptszKeyValueBuff );

            // Check whether file exists or not, searches for file in the standard paths
            // that are set
            BOOL bFound = PathFileExists( lptszKeyValueBuff );

            // Removes any quotes from path
            PathUnquoteSpaces( lptszKeyValueBuff );

            // If file is a shortcut then resolve to real path
            if( bFound &&
                    Utils::IsShortcut( lptszKeyValueBuff ))
            {
                bFound = Utils::ResolveShortcut( lptszKeyValueBuff );
            }

            csKeyValue.ReleaseBuffer();
            AddAutoStartExePath( csKeyValue );
        }// End if

        dwKeyNameLength = MAX_PATH;
    }// End for

    return true;
}// End GetAutoStartupApplicationPaths
/******************************************************************************
* open
*/
FileStatusTag LayerTypeXMLReader::open(const CString& filename)
{
   FileStatusTag retval = statusUndefined;

   ERRMsg.Empty();

   if (m_file == NULL)
   {
      m_file = new CFlexFile();
   }

   if (!m_file->Open(filename, CFile::modeRead))
   {
      retval = statusFileOpenFailure;
   }
   else
   {
      m_lastFilePos = 0;
      retval = statusInvalidHeader;

      CString header("<LAYERTYPEDOC ");
      CString headerBuf;
      int strLen = header.GetLength();

      if (m_file->Read(headerBuf.GetBufferSetLength(strLen), strLen))
      {
         headerBuf.GetBufferSetLength(strLen);

         if (headerBuf.CompareNoCase(header) == 0)
         {
            m_file->SeekToBegin();

            fileName = filename;
            retval = statusSucceeded;
         }
         else
         {
            m_file->Close();
         }
      }
   }

   return retval;
}
CString CBaseDialog::CmGetAppPath()
{
	CString strPath;
	GetModuleFileName(NULL,strPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
	strPath.ReleaseBuffer();
	int nPos;
	nPos = strPath.ReverseFind('\\');
	strPath = strPath.Left(nPos);
	return strPath;
}
Example #11
0
CString    ReturnPath()
{   
	CString    sPath;   
	GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);   
	sPath.ReleaseBuffer    ();   
	int    nPos;   
	nPos=sPath.ReverseFind('\\');   
	sPath=sPath.Left(nPos);   
	return    sPath;   
}
Example #12
0
// ----------------------------------------------------------------------------
//
CString MusicPlayer::getLastPlayerError( ) 
{
    VERIFY_LIBRARY_LOADED;

    CString buffer;
    buffer.Empty();
    (*m_GetLastPlayerError)( buffer.GetBufferSetLength( 512 ), 512 );
    buffer.ReleaseBuffer();
    return buffer;
}
Example #13
0
void Stream::ThrowError(LPCTSTR fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    int len = _vsctprintf(fmt, args) + 1;
    CString str;
    if(len > 0) _vstprintf_s(str.GetBufferSetLength(len), len, fmt, args);
    va_end(args);

    throw Exception(_T("Error (Ln %d Col %d): %s"), m_line + 1, m_col + 1, str);
}
Example #14
0
void CTemplateCADApp::InitializeWorkingDir()
{
	//存放路径[默认工程文件与可执行程序在同一目录下]
	CString exeFullPath;   

	//第一个参数为NULL时,则得到调用当前DLL文件的可执行程序的路径,为DLL句柄时,就得到DLL文件的路径
	GetModuleFileName(NULL, exeFullPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH);
	cout << _T("\n模板程序的路径是【%s】") << exeFullPath.GetBuffer();

	m_szWorkingDirectory = exeFullPath.Left(exeFullPath.ReverseFind('\\'));
}
Example #15
0
void AFXAPI DDX_FieldLBString(CDataExchange* pDX, int nIDC, CString& value,
                              CRecordset* pRecordset)
{
    ASSERT_VALID(pRecordset);

    HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
    if (pDX->m_bSaveAndValidate)
    {
        int nIndex = (int)::SendMessage(hWndCtrl, LB_GETCURSEL, 0, 0L);
        if (nIndex != -1)
        {
            int nLen = (int)::SendMessage(hWndCtrl, LB_GETTEXTLEN, nIndex, 0L);
            if (nLen > value.GetAllocLength())
                AfxFailMaxChars(pDX, value.GetAllocLength());
            ::SendMessage(hWndCtrl, LB_GETTEXT, nIndex,
                          (LPARAM)(LPSTR)value.GetBuffer(0));
            if (nLen == 0)
            {
                if (pRecordset->IsFieldNullable(&value))
                    pRecordset->SetFieldNull(&value, TRUE);
            }
            else
            {
                pRecordset->SetFieldNull(&value, FALSE);
            }
            value.ReleaseBuffer();
        }
        else
        {
            // no selection
            value.GetBufferSetLength(0);
            if (pRecordset->IsFieldNullable(&value))
                pRecordset->SetFieldNull(&value);
        }
    }
    else
    {
        if (!pRecordset->IsOpen() || pRecordset->IsFieldNull(&value))
        {
            SendMessage(hWndCtrl, LB_SETCURSEL, (WPARAM)-1, 0L);
        }
        else
        {
            // set current selection based on data string
            if (::SendMessage(hWndCtrl, LB_SELECTSTRING, (WPARAM)-1,
                              (LPARAM)(LPCTSTR)value) == LB_ERR)
            {
                // no selection match
                TRACE0("Warning: no listbox item selected.\n");
            }
        }
    }
}
Example #16
0
void WINAPI CTNTServer::OnReceive(const CONNECTION_ID&	Connection, 
									   const LPVOID			pData,
									   const DWORD			dwDataLen)
{
	CFixBuffer&	InputStream = m_mapPeers[Connection.m_Socket].m_InputStream;

	InputStream.Put(pData, dwDataLen);

	while(true)
	{
		// is there a room for MsgSize?
		if(InputStream.GetLength() < MESSAGE_HEADER_SIZE)
			return;

		CString strSize;
		char* pSizeString = strSize.GetBufferSetLength(4);
		memcpy(pSizeString,((char*)InputStream.GetData() + sizeof(char)*25),3);
		pSizeString[3]=0;
		strSize.ReleaseBuffer();
		DWORD dwSize = (DWORD)atol(strSize);

		// is there a room for Msg?
		if(InputStream.GetLength() < dwSize)
			return;

		for(COMMANDS_TYPE::iterator index = m_ValidIncomingCommands.begin(); index != m_ValidIncomingCommands.end(); index++)
		{
			CMMHHMessage* pitem= *index;
			if(pitem->Parse(InputStream) == ERROR_SUCCESS)
			{
				CMessageItem	Item;
				if(IsStopped())
					break;
				Item.m_pMessage = pitem->GetNewCopy();
				TMapPeers::iterator it = m_mapPeers.find(Connection.m_Socket);
				if(it == m_mapPeers.end())
				{
					ATLASSERT(false);
					return;
				}

				Item.m_Client = it->first;
				m_queIncoming.Push(Item);
				break;
			}
		}
		if(IsStopped())
			return;
	}
}
Example #17
0
	VOID CProcessMgr::GetProcessFullPath( DWORD dwProcessID,CString& strFullPath )
	{
		strFullPath=_T("");

		DWORD dwCount;
		HANDLE hProcess=GetProcessHandleByPID(dwProcessID);
		if (hProcess==INVALID_HANDLE_VALUE)
			return;
		if ( Utils::AppGetSystemInfo()->IsVistaOrLater() )
		{
			// VistaAbove
			dwCount=MAX_PATH;
			HMODULE hModule=::LoadLibrary(_T("kernel32.dll"));
#ifdef _UNICODE
			PFQueryFullProcessImageNameW PFQueryFullProcessImageName=(PFQueryFullProcessImageNameW)GetProcAddress(hModule, "QueryFullProcessImageNameW");
			if (PFQueryFullProcessImageName!=NULL)
			{
				PFQueryFullProcessImageName(hProcess,0,strFullPath.GetBufferSetLength(MAX_PATH),&dwCount);
				strFullPath.ReleaseBuffer(dwCount);
			}
#else
			PFQueryFullProcessImageNameA PFQueryFullProcessImageName=(PFQueryFullProcessImageNameA)GetProcAddress(hModule, "QueryFullProcessImageNameA");
			if (PFQueryFullProcessImageName!=NULL)
			{
				PFQueryFullProcessImageName(hProcess,0,strFullPath.GetBufferSetLength(MAX_PATH),&dwCount);
				strFullPath.ReleaseBuffer(dwCount);
			}
#endif // _UNICODE

		}
		else
		{	// XP
			dwCount=GetModuleFileNameEx(hProcess,NULL,strFullPath.GetBufferSetLength(MAX_PATH),MAX_PATH);
			strFullPath.ReleaseBuffer(dwCount);
		}
	}
Example #18
0
CStringW SourceEdit::GetTextRange(int cpMin, int cpMax, int len)
{
  if (cpMin < 0)
    cpMin = 0;
  if ((len >= 0) && (cpMax > len))
    cpMax = len;

  TextRange range;
  range.chrg.cpMin = cpMin;
  range.chrg.cpMax = cpMax;

  CString utfText;
  range.lpstrText = utfText.GetBufferSetLength(cpMax-cpMin+1);
  CallEdit(SCI_GETTEXTRANGE,0,(sptr_t)&range);
  utfText.ReleaseBuffer();
  return TextFormat::UTF8ToUnicode(utfText);
}
Example #19
0
//************************************
// Method:    ReadInAutoStartAppsFromStartupFolder
// FullName:  CAutoStartupInfo::ReadInAutoStartAppsFromStartupFolder
// Access:    private
// Returns:   bool
// Qualifier:
//************************************
bool CAutoStartupInfo::FindExeFromPath( CString csPath_i )
{
    // Prepare wild card string for fetching all files from the startup folder
    csPath_i += _T( "*.*" );

    // Helper for finding files
    CFileFind cfFileFinder;
    BOOL bFound = cfFileFinder.FindFile( csPath_i );

    // Keep searching
    while( bFound )
    {
        bFound = cfFileFinder.FindNextFile();

        // Skip dots and directories
        if( cfFileFinder.IsDots() ||
                cfFileFinder.IsDirectory() )
        {
            continue;
        }

        CString csFilePath = cfFileFinder.GetFilePath();
        if( !PathIsExe( csFilePath ))
        {
            if( Utils::IsShortcut( csFilePath ))
            {
                LPTSTR lptszPath = csFilePath.GetBufferSetLength( MAX_PATH );

                // Resolve path
                const BOOL bIsResolved = Utils::ResolveShortcut( lptszPath );
                csFilePath.ReleaseBuffer();
                if( !bIsResolved )
                {
                    continue;
                }
            }// End if
        }// End if

        // Found a valid exe, store it in our collection
        AddAutoStartExePath( csFilePath );
    }// End while

    return true;
}// End FindExeFromPath
Example #20
0
BOOL CPaletteBar::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID )
{
	BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParentWnd, nID);

	m_nButtonCount = ID_ELLIPSE - ID_ERASE + 1;

	VERIFY(AddBitmap(m_nButtonCount,IDR_PALETTEBAR) != -1);

	m_pTBButtons = new TBBUTTON[m_nButtonCount];

	int nIndex;
	for (nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + ID_ERASE);

		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR* pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;

		VERIFY((m_pTBButtons[nIndex].iString = AddStrings(pString)) != -1);

		string.ReleaseBuffer();


		m_pTBButtons[nIndex].fsState = TBSTATE_ENABLED;
		m_pTBButtons[nIndex].fsStyle = TBSTYLE_CHECKGROUP;
		m_pTBButtons[nIndex].dwData = 0;
		m_pTBButtons[nIndex].iBitmap = nIndex;
		m_pTBButtons[nIndex].idCommand = nIndex + ID_ERASE;

	}


	for (nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		VERIFY(AddButtons(1,&m_pTBButtons[nIndex]));
	}


	return bRet;
}
Example #21
0
void CQListCtrl::GetToolTipText(int nItem, CString &csText)
{
	CWnd* pParent=GetParent();
	if(pParent && (pParent->GetSafeHwnd() != NULL))
	{
		CQListToolTipText info;
		memset(&info, 0, sizeof(info));
		info.hdr.code = NM_GETTOOLTIPTEXT;
		info.hdr.hwndFrom = GetSafeHwnd();
		info.hdr.idFrom = GetDlgCtrlID();
		info.lItem = nItem;
		//plus 100 for extra info - shortcut and such
		info.cchTextMax = g_Opt.m_bDescTextSize + 100;
		info.pszText = csText.GetBufferSetLength(info.cchTextMax);
		
		pParent->SendMessage(WM_NOTIFY,(WPARAM)info.hdr.idFrom,(LPARAM)&info);
		
		csText.ReleaseBuffer();			
	}
}
Example #22
0
BOOL CDllCenter::GetDllPath(CStringArray& arDllPath)
{
	arDllPath.RemoveAll();

	CString strPath;
	GetModuleFileName(NULL, strPath.GetBufferSetLength(MAX_PATH + 1), MAX_PATH);
	strPath.ReleaseBuffer();
	int nPos = strPath.ReverseFind('\\');
	strPath = strPath.Left(nPos);

	CFileFind finder;
	BOOL bWorking = finder.FindFile(strPath + _T("\\\\" + "*.dll"));
	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		arDllPath.Add(finder.GetFileName());
	}

	return TRUE;
}
Example #23
0
void CIVConnection::QueryStatusText(HINTERNET hFile, CString & rstr)
{
	rstr.Empty();
	
	DWORD dwLen = 0;
	::HttpQueryInfo(hFile, HTTP_QUERY_STATUS_TEXT, NULL, &dwLen, 0);
		
	if (dwLen)	
	{
		DWORD dwChars = dwLen / sizeof (TCHAR);

		LPTSTR pstr = rstr.GetBufferSetLength(dwChars);
		BOOL bRet = HttpQueryInfo(hFile, HTTP_QUERY_STATUS_TEXT, pstr, &dwLen, NULL);
		if (bRet)
			rstr.ReleaseBuffer(dwChars);
		else
			rstr.ReleaseBuffer(0);
	}

	return;
}
const RPObjectClassInfo* RPView::getSrcClassInfo( COleDataObject* pDataObject ) const
{
	if ( !pDataObject->IsDataAvailable( CF_TEXT ) ) {
		return NULL;
	}
	HGLOBAL hglobal = pDataObject->GetGlobalData( CF_TEXT );
	if ( hglobal ) {
		CMemFile sf( static_cast<BYTE*>(::GlobalLock(hglobal)), ::GlobalSize(hglobal) );
		CString buffer;
		LPSTR str = buffer.GetBufferSetLength( ::GlobalSize(hglobal) );
		sf.Read( str, ::GlobalSize(hglobal) );
		::GlobalUnlock( hglobal );
		rp::string src_class_name( buffer );
		const RPObjectClassInfo* src_class_info = rpMethod::factory->getClassInfo( src_class_name );
		const RPObjectClassInfo* trg_class_info = flowchart->getObjectFlowChart().getClassInfo();
		if ( src_class_info && trg_class_info && src_class_info->getMethod() && src_class_info->getMethod() == trg_class_info->getMethod() ) {
			return src_class_info;
		} else {
			return NULL;
		}
	}
	return NULL;
}
Example #25
0
UINT32 StPitc::SendPitcCommand(StApi& api)
{
    UINT8 moreInfo = 0;
    UINT32 err;

    err = _pHidDevice->SendCommand(api, &moreInfo);
    if ( err == ERROR_SUCCESS ) {
        _strResponse = api.ResponseString();
        if ( _strResponse.IsEmpty() )
            _strResponse = _T("OK");
    }
    else
    {
        _strResponse.Format(_T("Error: SendCommand(%s) failed. (%d)\r\n"), api.GetName(), err);

        CString strTemp;
#if 0
        FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, strTemp.GetBufferSetLength(MAX_PATH), MAX_PATH, NULL);
#endif
        _strResponse.AppendFormat(_T("%s"), strTemp.c_str());

    }

    if ( moreInfo )
    {
        _strResponse = api.GetSendCommandErrorStr();

        HidPitcRequestSense senseApi;
        err = _pHidDevice->SendCommand(senseApi, &moreInfo);
        if ( err == ERROR_SUCCESS ) {
            _strResponse.AppendFormat(_T("\r\n%s"), senseApi.ResponseString().c_str());
            err = senseApi.GetSenseCode();
        }
    }

    return err;
}
Example #26
0
int CSVPNet::SetCURLopt(CURL *curl)
{
	//struct curl_slist *headerlist=NULL;
	//static const char buf[] = "Expect:";
	AppSettings& s = AfxGetAppSettings();

	char buff[MAX_PATH];
	if(s.szOEMTitle.IsEmpty()){
		sprintf_s( buff, "SPlayer Build %d", SVP_REV_NUMBER );
	}else{
		CSVPToolBox svpToolBox;
		int iDescLen = 0;
		char *oem = svpToolBox.CStringToUTF8(s.szOEMTitle, &iDescLen);
		sprintf_s( buff, "SPlayer Build %d OEM%s", SVP_REV_NUMBER ,oem );
		free(oem);
	}
	char buff_cookie[UNIQU_HASH_SIZE];
	memset(buff_cookie,0,UNIQU_HASH_SIZE);
	{
		
		CString path;
		GetModuleFileName(NULL, path.GetBuffer(MAX_PATH), MAX_PATH);
		path.ReleaseBuffer();
		int Ret = -1;
		path.MakeLower();
		//SVP_LogMsg5(L"got splayer path %s" ,path);
		if( path.Find(_T("splayer")) >= 0 || path.Find(_T("svplayer")) >= 0 || path.Find(_T("mplayerc")) >= 0  ){
			DWORD             dwHandle;
			UINT              dwLen;
			UINT              uLen;
			UINT              cbTranslate;
			LPVOID            lpBuffer;

			dwLen  = GetFileVersionInfoSize(path, &dwHandle);

			TCHAR * lpData = (TCHAR*) malloc(dwLen);
			if(lpData){
				
			memset((char*)lpData, 0 , dwLen);


				/* GetFileVersionInfo() requires a char *, but the api doesn't
				* indicate that it will modify it */
				if(GetFileVersionInfo(path, dwHandle, dwLen, lpData) != 0)
				{
					
						CString szParm( _T("\\StringFileInfo\\000004b0\\FileDescription"));

						if(VerQueryValue(lpData, szParm, &lpBuffer, &uLen) != 0)
						{

							CString szProductName((TCHAR*)lpBuffer);
							//SVP_LogMsg3("szProductName %s", szProductName);
							szProductName.MakeLower();

							if(szProductName.Find(_T("射手")) >= 0 || szProductName.Find(_T("splayer")) >= 0  ){
								Ret = 125;
								
							}
						}

				
				}
			}
		}
		if(Ret == 125){
			//sprintf_s(buff_cookie , UNIQU_HASH_SIZE, "UQID=%s", uniqueIDHash);
			//curl_easy_setopt(curl, CURLOPT_COOKIE , buff_cookie);
		}else{
			//sprintf_s(buff_cookie , UNIQU_HASH_SIZE, "UQID=%s", uniqueIDHash);
			
			//curl_easy_setopt(curl, CURLOPT_COOKIE , buff_cookie);
		}
	}
	

	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
	curl_easy_setopt(curl, CURLOPT_USERAGENT, buff);

	curl_easy_setopt(curl, CURLOPT_TIMEOUT, 40);
	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 20);
	curl_easy_setopt(curl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_0); //must use 1.0 for proxy

	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
	//curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv2);
#if 1
    if(iTryID%2 == 0){
	    DWORD ProxyEnable = 0;
	    CString ProxyServer;
	    DWORD ProxyPort = 0;

	    ULONG len = 256+1;
	    CRegKey key;
	    if( ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), KEY_READ)
		    && ERROR_SUCCESS == key.QueryDWORDValue(_T("ProxyEnable"), ProxyEnable) && ProxyEnable
		    && ERROR_SUCCESS == key.QueryStringValue(_T("ProxyServer"), ProxyServer.GetBufferSetLength(256), &len))
	    {
    		

    	
		    CStringA p_str("http://");
		    p_str.Append(CStringA(ProxyServer));
		    curl_easy_setopt(curl, CURLOPT_PROXY,  p_str.GetBuffer());//
		    p_str.ReleaseBuffer();
		    //curl_easy_setopt(curl, CURLOPT_PROXYPORT, 3128);
		    //p_str.ReleaseBuffer();
		    //curl_easy_setopt(curl,CURLOPT_PROXYTYPE,CURLPROXY_HTTP_1_0);
		    SVP_LogMsg6("Using proxy %s", p_str);
    	
		    //ProxyServer.ReleaseBufferSetLength(len);
	    }else{
		    //curl_easy_setopt(curl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_NONE);
	    }
    }
#endif

    if(fp_curl_verbose){
	    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
        curl_easy_setopt(curl, CURLOPT_STDERR, fp_curl_verbose);
    }

    //SVP_LogMsg5(L"iTryID %d", iTryID);
	//curl_easy_setopt(curl, CURLOPT_ENCODING, "gzip"); not native supported. so dont use this option
	// MUST not have this line curl_easy_setopt(curl, CURLOPT_POST, ....);
	
	//headerlist = curl_slist_append(headerlist, buf); //WTF ??
	//curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
	return 0;
}
Example #27
0
void CIVConnection::GetHTTPData(LPCTSTR szQuery, CString &rstr)
{
	TRACE (_T("HTTP Request: %s\n"), szQuery);

	DWORD dwServiceType = 0;
	CString strServer;
	CString strObject;		
	INTERNET_PORT nPort=0;
	bool    bFirst = false;
	
	HINTERNET hFile = NULL;

	bool bFailed = false;
	
	try
	{
		while(1)
		{
			if(!m_strHeader.GetLength())
				hFile = ::InternetOpenUrl (m_hSession, szQuery, NULL, 0,  INTERNET_FLAG_DONT_CACHE, 0 );
			else
				hFile = ::InternetOpenUrl (m_hSession, szQuery, (LPCSTR)m_strHeader, m_strHeader.GetLength(),  INTERNET_FLAG_DONT_CACHE, 0 );

			if (! hFile)
				AfxThrowInternetException(0);

			rstr.Empty();

			const int nSizeBuffer = 1024;
			BYTE pBuffer [nSizeBuffer];
			DWORD dwTotalRead = 0;

			while (true)
			{
				DWORD dwRead = 0;
				BOOL bResult = ::InternetReadFile (hFile, pBuffer, nSizeBuffer, &dwRead);
				if (! bResult)
					AfxThrowInternetException(0);
				
				if (dwRead ==0)
					break;

				DWORD dwOldTotal = dwTotalRead;
				dwTotalRead += dwRead;		

				LPTSTR szTarget = rstr.GetBuffer(dwTotalRead);
				szTarget += dwOldTotal;
	#ifndef _UNICODE				
				memcpy (szTarget, pBuffer, dwRead);
	#else
				MultiByteToWideChar (CP_ACP, 0, (LPCSTR) pBuffer, dwRead, szTarget, dwRead);			
	#endif //_UNICODE
				rstr.ReleaseBuffer(dwTotalRead);
			}

			if ( CheckErrorMessage(rstr) ) 
				bFailed = true;
			else
			{
				DWORD dwStatus = QueryInfoStatusCode(hFile);
				if(HTTP_STATUS_PROXY_AUTH_REQ == dwStatus && !bFirst && m_opts.m_iProxyAuth)
				{
					bFirst = true;

					CString strIn;
					CString strOut;
					unsigned nLen = 0;
					
					strIn.Format(_T("%s:%s"), (LPCTSTR)m_opts.m_strProxyLogin, (LPCTSTR)m_opts.m_strProxyPassword);
					encode64((LPCSTR)strIn, strIn.GetLength(), strOut.GetBufferSetLength(200), 190, &nLen);
					strOut.ReleaseBuffer();
					m_strHeader.Format(_T("Proxy-Authorization: Basic %s\r\n"),(LPCTSTR)strOut);
					InternetCloseHandle(hFile);
					continue;

				}
				if(!m_opts.m_iProxyAuth)
					m_strHeader = _T("");

				if ( HttpError (hFile, dwStatus) )
					bFailed = true;
			}
			break;
		}
	}
	catch (CInternetException * e )
	{
		bFailed = true;
		
		if ( e->m_dwError  != ERROR_INTERNET_OPERATION_CANCELLED  &&
			e->m_dwError  != ERROR_INVALID_HANDLE )
		{
			TCHAR szError [512] = _T("") ;
			e->GetErrorMessage(szError, sizeof (szError) / sizeof (TCHAR) );
			SetError (GetCommonIVError(szError));
		}
		else
			TRACE (_T("CIVConnection - canceled\n"));

		e->Delete();
	}

	TRACE (_T("End of HTTP request\n"));

	if (hFile)
		::InternetCloseHandle (hFile);

	if (bFailed)
		AfxThrowUserException();
}
Example #28
0
//-----  OnSizeParent()  ------------------------------------------------------
BOOL BCTabBarCtrl::RemoveAllViews()
{ 
	ASSERT(::IsWindow(m_hWnd)); 
	int iCount = GetItemCount();
	
	ASSERT(iCount > 1);	// 1 view must be left

	if(iCount < 2)
	{
		return FALSE;
	}

	BARTCITEM itemSave;
	BARTCITEM item;

	CString csBuffer;
	CString csItemText;

	/**** JohnCz ***/
	// kill all views except current
	for(int iIndx = 0; iIndx < iCount; iIndx++)
	{
		item.hdr.mask = TCIF_ALL_BAR;
		
		LPTSTR pBuf = csBuffer.GetBufferSetLength(MAX_PATH);
		item.hdr.cchTextMax = MAX_PATH;
		item.hdr.pszText = pBuf;
		
		GetItem(iIndx, (TCITEMHEADER*)&item);
		
		csBuffer.ReleaseBuffer();

		ASSERT(item.pWnd);

		if(AFX_IDW_PANE_FIRST == item.pWnd->GetDlgCtrlID())
		{
			/**** JohnCz ***/
			// csBuffer	has different pointer on each iteration
			// this will just copy pointer of csBuffer string to csItemText data member 
			// so it will point to the same string in itemSave 
			csItemText = csBuffer;

			/**** JohnCz ***/
			// save for default view, do not destroy
			itemSave = item;
			continue;
		}
		item.pWnd->DestroyWindow();
	}

	/**** JohnCz ***/
	// delete all items
	BOOL bResult = ::SendMessage(m_hWnd, TCM_DELETEALLITEMS, 0, 0); 

	if(!bResult)
	{
		ASSERT(bResult); // something is wrong not right TCM_DELETEALLITEMS failed
		return bResult;
	}

	m_mapUsedID.RemoveAll();

	/**** JohnCz ***/
	// insert first item to manage current view
	bResult &= (-1 < ::SendMessage(m_hWnd, TCM_INSERTITEM, 0, (LPARAM)&itemSave));
	
	m_mapUsedID.SetAt(itemSave.uiID, itemSave.uiID);

	/**** JohnCz ***/
	// TCM_INSERTITEM ignores state, we have to set item to set the same state
	itemSave.hdr.mask = TCIF_STATE;
	bResult &= ::SendMessage(m_hWnd, TCM_SETITEM, 0, (LPARAM)&itemSave);

	ASSERT(bResult);
	m_pParentFrame->RecalcLayout();

	return bResult;
}
void OptionsDialog::ChangeDialogFont(CWnd* wnd, CFont* font)
{
  CRect windowRect;

  TEXTMETRIC tmOld, tmNew;
  CDC* dc = wnd->GetDC();
  CFont* oldFont = dc->SelectObject(wnd->GetFont());
  dc->GetTextMetrics(&tmOld);
  dc->SelectObject(font);
  dc->GetTextMetrics(&tmNew);
  dc->SelectObject(oldFont);
  wnd->ReleaseDC(dc);

  long oldHeight = tmOld.tmHeight+tmOld.tmExternalLeading;
  long newHeight = tmNew.tmHeight+tmNew.tmExternalLeading;

  // calculate new dialog window rectangle
  CRect clientRect, newClientRect, newWindowRect;

  wnd->GetWindowRect(windowRect);
  wnd->GetClientRect(clientRect);
  long xDiff = windowRect.Width() - clientRect.Width();
  long yDiff = windowRect.Height() - clientRect.Height();

  newClientRect.left = newClientRect.top = 0;
  newClientRect.right = clientRect.right * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;
  newClientRect.bottom = clientRect.bottom * newHeight / oldHeight;

  newWindowRect.left = windowRect.left - (newClientRect.right - clientRect.right)/2;
  newWindowRect.top = windowRect.top - (newClientRect.bottom - clientRect.bottom)/2;
  newWindowRect.right = newWindowRect.left + newClientRect.right + xDiff;
  newWindowRect.bottom = newWindowRect.top + newClientRect.bottom + yDiff;

  wnd->MoveWindow(newWindowRect);
  wnd->SetFont(font);

  CWnd* childWnd = wnd->GetWindow(GW_CHILD);
  while (childWnd)
  {
    childWnd->SetFont(font);
    childWnd->GetWindowRect(windowRect);

    CString strClass;
    ::GetClassName(childWnd->GetSafeHwnd(),strClass.GetBufferSetLength(32),31);
    strClass.MakeUpper();
    if (strClass == "COMBOBOX")
    {
      CRect rect;
      childWnd->SendMessage(CB_GETDROPPEDCONTROLRECT,0,(LPARAM)&rect);
      windowRect.right = rect.right;
      windowRect.bottom = rect.bottom;
    }

    wnd->ScreenToClient(windowRect);
    windowRect.left = windowRect.left * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;
    windowRect.right = windowRect.right * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;
    windowRect.top = windowRect.top * newHeight / oldHeight;
    windowRect.bottom = windowRect.bottom * newHeight / oldHeight;
    childWnd->MoveWindow(windowRect);

    childWnd = childWnd->GetWindow(GW_HWNDNEXT);
  }
}
//////////////////////////////////////////////////////////////////////////
// 바로가기 생성시
//////////////////////////////////////////////////////////////////////////
void COutputDialog::OnBnClickedBtnCreateShortcut()
{
	// 게임 실행파일 경로 얻기
	TCHAR szExeFileName[MAX_PATH] = {0,};
	if( ::GetModuleFileName( NULL, szExeFileName, MAX_PATH ) == FALSE ) return;

	CString strTmpName = szExeFileName;
	int nIdx = strTmpName.ReverseFind(_T('\\'));
	if(nIdx>=0) strTmpName = strTmpName.Mid(nIdx+1);
	nIdx = strTmpName.ReverseFind(_T('.'));
	if(nIdx>=0) strTmpName = strTmpName.Left(nIdx);

	// 실행 위치 결정	
	//CString strWorkDir = szExeFileName;
	//nIdx = strWorkDir.ReverseFind(_T('\\'));
	//if(nIdx > 0) strWorkDir = strWorkDir.Left(nIdx);
	//else strWorkDir = _T("");
	// 2008.10.28
	CString strWorkDir;	
	::GetCurrentDirectory(MAX_PATH, strWorkDir.GetBufferSetLength(MAX_PATH));
	strWorkDir.ReleaseBuffer();

	CShortcutDlg sc_dlg;
	sc_dlg.m_strShortcutFilePath = strWorkDir + _T("\\") + strTmpName + _T(".lnk");
	sc_dlg.m_strDelayTime = _T("0");
	sc_dlg.m_nShortcutType = 0;
	
	if( sc_dlg.DoModal() == IDOK )
	{
		// 아랄 트랜스 경로 얻기
		CString strAralTrans = _T("\"") + (MAINAPP)->m_strAralTransDir + _T("\\AralTrans.exe") + _T("\"");

		// 옵션 스트링 병합
		CString strAlgorithmOpt;
		this->GetDlgItem(IDC_EDIT_HOOK_OPTION_STRING)->GetWindowText(strAlgorithmOpt);
		CString strFilterOpt;
		this->GetDlgItem(IDC_EDIT_FILTER_OPTION_STRING)->GetWindowText(strFilterOpt);
		CString strTranslatorOpt;
		this->GetDlgItem(IDC_EDIT_TRANS_OPTION_STRING)->GetWindowText(strTranslatorOpt);

		// 스트링 concat (1차)
		CString strArg = strAlgorithmOpt + _T(" ") + strFilterOpt + _T(" ") + strTranslatorOpt;
		
		// 게임을 직접 실행한다면 (Execution Type)
		if(sc_dlg.m_nShortcutType == 0)
		{
			strArg += _T(" ");
			strArg += szExeFileName;
		}
		// 기존 게임을 후킹만 한다면 (Attachment Type)
		else
		{
			strArg += _T(" /P{") + strTmpName + _T(".exe}");

			// 로더 확인
			if (sc_dlg.m_strLoaderPath.Trim().IsEmpty() == FALSE)
			{
				strArg += _T(" ") + sc_dlg.m_strLoaderPath;
			}
		}

		// 스레드 시작주소 입력
		CString strADR = CRegistryMgr::RegRead(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("SetTidAdr"));
		if( strADR.GetLength() > 0 )
			strArg += _T(" /M{") + strADR + _T("}");

		// 바이너리 선행패치 유무
		int nRestart = CRegistryMgr::RegReadDWORD(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("BinaryRestart"));
		if( nRestart > 0 )
			strArg += _T(" /R");

		// 바이너리 패치 여부
		int nBiPatch = CRegistryMgr::RegReadDWORD(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("BinaryPatch"));
		if( nBiPatch )
		{
			strArg += _T(" /b:{");
			int nCount = 0;
			CString regCount;
			unsigned char* cBuff = (unsigned char*)malloc(0x10000);

			while( nBiPatch > nCount )
			{
				nCount ++;
				DWORD dwPatchAdr = 0;
				regCount.Format(_T("BinaryName%d"),nCount);
				regCount = CRegistryMgr::RegRead(_T("HKEY_CURRENT_USER\\Software\\AralGood"), regCount);
				if( regCount != _T("") )
					strArg += regCount + _T("!");
				regCount.Format(_T("BinaryAdr%d"),nCount);
				regCount.Format(_T("%08x("),CRegistryMgr::RegReadDWORD(_T("HKEY_CURRENT_USER\\Software\\AralGood"), regCount));
				strArg += regCount;
				regCount.Format(_T("Binary%d"),nCount);
				int len = CRegistryMgr::RegReadBINARY(_T("HKEY_CURRENT_USER\\Software\\AralGood"), regCount, cBuff);
				int pos = 0;
				while( len > pos )
				{
					regCount.Format(_T("%02x"),cBuff[pos]);
					strArg += regCount;
					pos ++;
				}
				strArg += _T(")");
				
				if( nBiPatch > nCount )
					strArg += _T(",");
			}
			free(cBuff);
			strArg += _T("}");
		}

		if(sc_dlg.m_nHideType == 1)
			strArg += _T(" /H");

		// 후킹 딜레이
		if(sc_dlg.m_strDelayTime.Trim().IsEmpty() == FALSE)
		{
			int nDelay = _ttoi(sc_dlg.m_strDelayTime);
			if(nDelay > 0)
			{
				CString strDelayOption;
				strDelayOption.Format(_T(" /D%d"), nDelay);
				strArg += strDelayOption;
			}
		}
		
		HMODULE hKonJ = GetModuleHandle(_T("KonJ.dll"));
		HMODULE hJonK = GetModuleHandle(_T("JonK.dll"));
		HMODULE hNtlea = GetModuleHandle(_T("ntleah.dll"));

		// 어플로케일 사용 여부
		if(CAppLocMgr::IsLoaded())
		{
			strArg += _T(" /L");
		}
		// KonJ 사용여부
		else if(hKonJ)
		{			
			strArg += _T(" /KonJ");
			
			// KonJ 디렉토리를 레지스트리에 쓰기
			TCHAR szDllFilePath[MAX_PATH] = {0,};
			if( ::GetModuleFileName( hKonJ, szDllFilePath, MAX_PATH ) )
			{
				LPTSTR ptrDirEnd = _tcsrchr(szDllFilePath, _T('\\'));
				if(ptrDirEnd)
				{
					*ptrDirEnd = _T('\0');
					CRegistryMgr::RegWrite(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("KonJJonKDir"), szDllFilePath);
				}
			}
		}
		// KonJ 사용여부
		else if(hJonK)
		{			
			strArg += _T(" /JonK");

			// KonJ 디렉토리를 레지스트리에 쓰기
			TCHAR szDllFilePath[MAX_PATH] = {0,};
			if( ::GetModuleFileName( hJonK, szDllFilePath, MAX_PATH ) )
			{
				LPTSTR ptrDirEnd = _tcsrchr(szDllFilePath, _T('\\'));
				if(ptrDirEnd)
				{
					*ptrDirEnd = _T('\0');
					CRegistryMgr::RegWrite(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("KonJJonKDir"), szDllFilePath);
				}
			}
		}
		// NTLEA 사용여부
		else if(hNtlea)
		{			
			strArg += _T(" /N");

			// NTLEA 디렉토리를 레지스트리에 쓰기
			TCHAR szDllFilePath[MAX_PATH] = {0,};
			if( ::GetModuleFileName( hNtlea, szDllFilePath, MAX_PATH ) )
			{
				LPTSTR ptrDirEnd = _tcsrchr(szDllFilePath, _T('\\'));
				if(ptrDirEnd)
				{
					*ptrDirEnd = _T('\0');
					CRegistryMgr::RegWrite(_T("HKEY_CURRENT_USER\\Software\\AralGood"), _T("NtleaDir"), szDllFilePath);
				}
			}
		}
		
		// 생성될 바로가기 대상의 전체길이가 250자를 넘는다면
		if( strAralTrans.GetLength()+strArg.GetLength() > 250 )
		{
			// 고유 ID 생성	
			UUID uuid = {0,};
			unsigned short* sz = NULL;

			if( UuidCreate(&uuid) != RPC_S_OK || UuidToString(&uuid, &sz) == RPC_S_OK )
			{
				CString strGUID = (LPCWSTR)sz;
				RpcStringFree(&sz);

				if( CRegistryMgr::RegWrite(_T("HKEY_CURRENT_USER\\Software\\AralGood\\StoredOption"), strGUID, strAralTrans + _T(" ") + strArg) == TRUE)
				{
					strArg.Format(_T("/r:%s"), strGUID);
				}

			}

		}
		
		BOOL bRes = CreateShortcut(sc_dlg.m_strShortcutFilePath, strAralTrans, strArg, strWorkDir, szExeFileName, _T("AralTrans Autorun Icon"));

		if(bRes)
		{
			this->MessageBox(_T("바로가기가 생성되었습니다."), _T("알림"));
		}
		else
		{
			this->MessageBox(_T("바로가기 생성 중 오류가 발생했습니다."), _T("알림"));
		}
		

	}

	// 작업 디렉토리 복구 (2008.10.28 by sc.Choi)
	::SetCurrentDirectory(strWorkDir);
}