Ejemplo n.º 1
0
bool CDirectoryHelper::CreateDirectoryD(const wchar_t *dir)
{
	DDString::CZString str(dir,wcslen(dir));

	if(L':' != dir[1] || L'\\' != dir[2])
	{
		if(L'\\' == dir[0])
			str = GetModuleDir(0) + str;
		else
		{
			str = GetModuleDir(0) +L"\\"+ str;
		}
	}

	int index = str.IndexOf(L'\\',3);
	//DDString::CZStringW str;
	DDString::CZString strTmp;
	while(-1 != index)
	{
		strTmp = str.SubString(0,index);
		if(strTmp.GetDataLength() > 2 && !DirectoryExist(strTmp.GetData())) // exclude "\" directory, etc.:"\dir\"
		{
			if(!CreateDirectory(strTmp.GetData(),0))
				return false;
		}
		index = str.IndexOf(L'\\',index + 1);
	}
	
	return true;
}
Ejemplo n.º 2
0
/* XXX: can we find a better place for this? */
static LightsDriver *TryModuleDriver( const CString &sName )
{
	/* e.g. "stdout" looks for "LightsDriver_Stdout.so" */
	CString sDriverName = "LightsDriver_" + sName + LIB_EXTENSION;

	CString sRagePath = "Data/Modules/" + sDriverName;
	CString sRealPath = GetModuleDir() + sDriverName;

	if( !IsAFile(sRagePath) )
		return NULL;

#if defined(LINUX)
	LightsDriver_Dynamic *ret = new LightsDriver_Dynamic_Unix( sRealPath );
#else
	LightsDriver_Dynamic *ret = NULL;
	// TODO: LightsDriver_Dynamic_Win32
	return NULL;
#endif

	ret->Load();

	/* if this module couldn't actually load, don't return it. */
	if( !ret->IsLoaded() )
		SAFE_DELETE( ret );

	return ret;
}
Ejemplo n.º 3
0
BOOL CommonStrMethod::CreateFile(CString strFile)
{
	CString strFileName = GetNameFromAbsName(strFile);
	CString strPath = GetPathFromAbsName(strFile);
	if(!IsAbsPath(strPath))
	{
		if(strPath.GetLength() > 0)
		{
			if(strPath.GetAt(0) == _T('\\') || strPath.GetAt(0) == _T('/'))
			{
				strPath.Delete(0);
			}
		}
		strPath = GetModuleDir() + strPath;
	}
	if(!CreatePath(strPath))
	{
		return FALSE;
	}
	HANDLE hFile = ::CreateFile(strPath + strFileName, GENERIC_ALL, FILE_SHARE_READ,
		NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	if(hFile == INVALID_HANDLE_VALUE)
	{
		return FALSE;
	}

	::CloseHandle(hFile);

	return TRUE;
}
Ejemplo n.º 4
0
BOOL CTeapotApp::InitInstance()
{
    CWinApp::InitInstance();

    // 如果装配文件 (manifest) 中指定使用 Windows 通用控件 ComCtl32.dll 6.0+ 版本, 则在 Windows XP 下需要调用 InitCommonControlsEx(), 否则窗口创建将失败
    // 设置程序中能够使用的通用控件类, ICC_WIN95_CLASSES 表示所有 Win95 通用控件
    INITCOMMONCONTROLSEX initCtrls;
    initCtrls.dwSize = sizeof(initCtrls);
    initCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&initCtrls);

    InitLocale();

    // 计算主模块全路径, 设置工作目录
    InitModulePath(MAX_PATH);
    InitWorkDir(GetModuleDir());

    // NOTE:
    // 保存应用设置选项的注册表键, 通常命名为开发公司, 组织, 团队的名字
    // 该函数设定 m_pszRegistryKey, 并影响 GetProfileInt 等函数
    // 保存应用设置的注册表键:
    // HKCU\Software\<company name>\<application name>\<section name>\<value name>
    // 当不使用注册表而使用 ini 文件时, 请去掉 SetRegistryKey
    SetRegistryKey(_T(MODULE_NAME));

    try {
        CMainFrame* pFrmWnd = new CMainFrame();

        // 由共享资源 IDR_MAINFRAME 创建主框架窗口, IDR_MAINFRAME 可同时标识: 菜单(必需), 快捷键, 主图标, 标题栏字符串
        pFrmWnd->LoadFrame(IDR_MAINFRAME);

        // NOTE: 在 Run 中显示窗口
        pFrmWnd->ShowWindow(SW_HIDE);

        m_pMainWnd = pFrmWnd;
    }
    catch (std::exception& e) {
        ERR_TRACEA("std::exception: what: %s, type: %s", e.what(), typeid(e).name());
        return FALSE;
    }
    catch (...) {
        ERR_TRACE("unknown exception");
        return FALSE;
    }

    return TRUE;
}
Ejemplo n.º 5
0
void CInetTools::SetStyleSheet(BOOL bSet, BOOL bUpdate)
{
	CString strEntry;
	HKEY hRegRoot, hReg;

	if (RegOpenKeyEx(HKEY_CURRENT_USER,
		_T("Software\\Microsoft\\Internet Explorer"), 0, KEY_WRITE|KEY_CREATE_SUB_KEY, &hRegRoot) != ERROR_SUCCESS)
		return;

	if (RegCreateKeyEx(hRegRoot, _T("Styles"), 0, 0, 0, KEY_WRITE, NULL, &hReg, NULL) != ERROR_SUCCESS)
	{
		RegCloseKey(hRegRoot);
		return;
	}

	
	RegSetValueEx(hReg, _T("Use My Stylesheet"), NULL, REG_DWORD , (LPBYTE)&bSet, sizeof(BOOL));
	
	if (bSet)
	{
		CString strPath = GetModuleDir() + _T("tables.css");
		RegSetValueEx(hReg, _T("User Stylesheet"), NULL, REG_SZ, (LPBYTE)(LPCTSTR)strPath, (strPath.GetLength() + 1) * sizeof(TCHAR));
	}
	
	RegCloseKey(hReg);
	RegCloseKey(hRegRoot);

	if (bUpdate)
	{
		const TCHAR pKey[] = _T("Software\\Microsoft\\Internet Explorer");
		DWORD_PTR dwResult;
		SendMessageTimeout(HWND_BROADCAST, WM_WININICHANGE, 0x1F, (LPARAM)pKey, 0, 0x64, &dwResult);
		
	}
	
}
Ejemplo n.º 6
0
STD_ERROR   DLLEXPORT	DRV_FunctionGenerator_Init ( char *pszDriverLocation , char *pszAddressString , int *pHandle )
{		   					
	STD_ERROR                                   StdError                                    =   {0};
	
	tsDriverInfo								*pDriverInfo							=	NULL;
	
	CmtTSVHandle 								VariableHandle							=	0;
	
	CmtThreadLockHandle 						LockHandle								=	0;
	
	pfFunctionGenerator_Init					pWrapperFunction						=	NULL;
	
	char										szCurrentDirectory[STD_STRING]			=	{0},
												szDriverLocation[STD_STRING]			=	{0},
												szMessage[STD_STRING]					=	{0},
												*pTemp									=	NULL;
	
	int											iTry									=	0,
												bHandleExists							=	0;
	
	int											bLocked									=	0;
	
	char										*pTempString							=	NULL;

	pfSTD_Config_Install_CommentCallback        pConfig_Install_CommentCallback			=	NULL;
	pfSTD_Config_Install_ConfigValueCallback    pConfig_Install_ConfigValueCallback		=	NULL;
	pfSTD_Config_Install_CheckForBreakCallback  pConfig_Install_CheckForBreakCallback	=	NULL;
	pfSTD_Config_Copy_STD_CallBackSet			pConfig_Copy_STD_CallBackSet			=	NULL;

	HINSTANCE									LibraryHandle							=	NULL;
	
	if (( pszDriverLocation == NULL ) || ( pszAddressString == NULL ))
		{STD_ERR (DRV_ERROR_PASSED_NULL);}
	
	strcpy( szDriverLocation , pszDriverLocation );
	
	do
	{
		pTemp = strstr( pszDriverLocation , ":\\" );
	
		if ( pTemp )
			break;
		
		pTemp = strchr( pszDriverLocation , '\\' ); 
		
		if ( pTemp == NULL )
			break;
			
		GetModuleDir( __CVIUserHInst , szCurrentDirectory ); 
		
		if ( pTemp == pszDriverLocation )
			sprintf( szDriverLocation , "%s%s" , szCurrentDirectory , pszDriverLocation );
		else
			sprintf( szDriverLocation , "%s\\%s" , szCurrentDirectory , pszDriverLocation ); 
		
	} while(0);
	
	if ( FileExists(szDriverLocation,NULL) == 0 )
	{
		sprintf( szMessage , "Loading Function Generator Driver\n\"%s\"\n\nFailed, File has not found." , szDriverLocation );
		ShowMessage ( INSTR_TYPE_CONTINUE , "Equipment driver file error..." , szMessage , NULL );
		
		FORCE_ERR(-5,szMessage);
	}
			 
	if ( pHandle )
	{
		if ( CmtNewTSV ( sizeof(tsDriverInfo) , &VariableHandle ) != 0 )
			{STD_ERR (DRV_ERROR_CREATE_TSV_HANDLE);}

		if ( VariableHandle == 0 )
			{STD_ERR (DRV_ERROR_CREATE_TSV_HANDLE);}
	
		do
		{
			*pHandle = VariableHandle;
	
			if ( CmtGetTSVPtr ( VariableHandle , &pDriverInfo ) < 0 )
			{
				{STD_ERR (DRV_ERROR_GET_TSV_POINTER);}
				break;
			}
	
			pDriverInfo->InstrumentType = DRIVER_TYPE_FUNCTION_GENERATOR;
	
			CALLOC_COPY_STRING( pDriverInfo->pInstrumentAddress , pszAddressString );  
		
			bHandleExists = DRIVER_MANAGER_IsConnectionExists( pszAddressString , &(pDriverInfo->InstrumentHandle) , &(pDriverInfo->InstrumentLockHandle) );

			//--------- Load Library ---------------------//
	
			pDriverInfo->LibraryHandle = LoadLibrary(szDriverLocation);

			CALLOC_COPY_STRING( pDriverInfo->pDriverFileName,szDriverLocation);
		
			if ( pDriverInfo->LibraryHandle == 0 )
			{
				{STD_ERR (DRV_ERROR_DLL_FILE_NOT_OPENED);}
				break;
			}	
		
		
			//--------------- Load functions ------------------//
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_CommentCallback								= (pfSTD_Config_Install_CommentCallback) GetProcAddress( pDriverInfo->LibraryHandle , 		"Config_Install_CommentCallback");      
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_ConfigValueCallback							= (pfSTD_Config_Install_ConfigValueCallback) GetProcAddress( pDriverInfo->LibraryHandle , 	"Config_Install_ConfigValueCallback");  
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_CheckForBreakCallback							= (pfSTD_Config_Install_CheckForBreakCallback) GetProcAddress( pDriverInfo->LibraryHandle , "Config_Install_CheckForBreakCallback");
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_LOG_SetAllowState										= (pfSTD_Config_LOG_SetAllowState) GetProcAddress( pDriverInfo->LibraryHandle , "Config_LOG_SetAllowState");
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Copy_STD_CallBackSet									= (pfSTD_Config_Copy_STD_CallBackSet) GetProcAddress( pDriverInfo->LibraryHandle , "Config_Copy_STD_CallBackSet");
			
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_GetErrorTextMessage     					= (pfFunctionGenerator_GetErrorTextMessage) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_GetErrorTextMessage");         
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Init                        				= (pfFunctionGenerator_Init) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Init");                        
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Close                       				= (pfFunctionGenerator_Close) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Close");                       
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Reset										= (pfFunctionGenerator_Reset) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Reset"); 
		
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Initiate              						= (pfFunctionGenerator_Initiate) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Initiate");                    
		    pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Signel_Off           						= (pfFunctionGenerator_Signel_Off) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Signel_Off");                 
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Signel_On            						= (pfFunctionGenerator_Signel_On) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Signel_On");            
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Save_State     							= (pfFunctionGenerator_Save_State) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Save_State");     
			pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Load_State      							= (pfFunctionGenerator_Load_State) GetProcAddress( pDriverInfo->LibraryHandle , "FunctionGenerator_Load_State");      
		
			pDriverInfo->tInstrDB.Equipment_Info      																			= (pfSTD_Equipment_Info) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_Info");      
			pDriverInfo->tInstrDB.Equipment_IsSupported																			= (pfSTD_Equipment_IsSupported) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_IsSupported");   
		
			pDriverInfo->tInstrDB.Equipment_SendStateFile																		= (pfSTD_Equipment_SendStateFile) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_SendStateFile");
			pDriverInfo->tInstrDB.Equipment_ReceiveStateFile																	= (pfSTD_Equipment_ReceiveStateFile) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_ReceiveStateFile");
			pDriverInfo->tInstrDB.Equipment_GetFileCatalog																		= (pfSTD_Equipment_GetFileCatalog) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_GetFileCatalog");
			pDriverInfo->tInstrDB.Equipment_MakeFileCatalog																		= (pfSTD_Equipment_MakeFileCatalog) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_MakeFileCatalog"); 			
			pDriverInfo->tInstrDB.Equipment_DeleteFileCatalog																	= (pfSTD_Equipment_DeleteFileCatalog) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_DeleteFileCatalog");
			pDriverInfo->tInstrDB.Equipment_DeleteStateFile																		= (pfSTD_Equipment_DeleteStateFile) GetProcAddress( pDriverInfo->LibraryHandle , "Equipment_DeleteStateFile");
			
			pDriverInfo->tInstrDB.Config_SetAttribute																			= (pfSTD_Config_SetAttribute) GetProcAddress( pDriverInfo->LibraryHandle , "Config_SetAttribute"); 		
			
			pWrapperFunction = pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.FunctionGenerator_Init;
	
			if ( pWrapperFunction == NULL )
			{
				char	szMessage[LOW_STRING]	= {0};
				
				sprintf( szMessage , "Method \"%s\"\nis not implemented in driver:\n%s" , "FunctionGenerator_Init" , pDriverInfo->pDriverFileName );
				
				ShowMessage ( INSTR_TYPE_CONTINUE , "Implementation Error . . ." , szMessage , NULL );
			
				{STD_ERR (DRV_ERROR_WRONG_WRAPPER);}
			}
		
			if ( !bHandleExists )
				DRIVER_MANAGER_AddConnection( pszAddressString , &(pDriverInfo->InstrumentHandle) , DRIVER_TYPE_FUNCTION_GENERATOR , &(pDriverInfo->InstrumentLockHandle) );
		
			LockHandle = pDriverInfo->InstrumentLockHandle;
		
			if ( LockHandle == 0 )
				{STD_ERR (DRV_ERROR_CREATE_LOCK_HANDLE);}
		
			CHK_PROCCESS_GET_LOCK ( LockHandle );
		
			DRIVER_MANAGER_IsConnectionExists( pszAddressString, &(pDriverInfo->InstrumentHandle) , NULL );
		
			//===================== Install Calbacks ==========================================================================================//
			pConfig_Install_CommentCallback = pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_CommentCallback;		
			pConfig_Install_ConfigValueCallback	= pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_ConfigValueCallback;		
			pConfig_Install_CheckForBreakCallback = pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Install_CheckForBreakCallback;		
			pConfig_Copy_STD_CallBackSet = pDriverInfo->tInstrDB.functionGeneratorDriverFunctions.Config_Copy_STD_CallBackSet;
		
			DRIVER_MANAGER_GetCopyCallbacksStructure( VariableHandle , &(pDriverInfo->ptCallbacks) , 1 , pszAddressString ); 
			
			if ( pConfig_Copy_STD_CallBackSet && ( pDriverInfo->ptCallbacks ))
			{
				FREE_STDERR_COPY_ERR( pConfig_Copy_STD_CallBackSet( &pDriverInfo->InstrumentHandle , pDriverInfo->ptCallbacks ));
				
				pDriverInfo->ptCallbacks = NULL;
			}
			else
			{
				if ( pConfig_Install_CommentCallback && ( pDriverInfo->ptCallbacks ))
				{
					FREE_STDERR_COPY_ERR( pConfig_Install_CommentCallback( &pDriverInfo->InstrumentHandle , (pDriverInfo->ptCallbacks)->fCommentCallback , (pDriverInfo->ptCallbacks)->pCommentCallbackData , (pDriverInfo->ptCallbacks)->commentType ));
				}
				
				if ( pConfig_Install_ConfigValueCallback && ( pDriverInfo->ptCallbacks ))
				{
					FREE_STDERR_COPY_ERR( pConfig_Install_ConfigValueCallback( &pDriverInfo->InstrumentHandle , (pDriverInfo->ptCallbacks)->fConfigValueCallback , (pDriverInfo->ptCallbacks)->pConfigValueCallbackData , (pDriverInfo->ptCallbacks)->configType ));
				}
		
				if ( pConfig_Install_CheckForBreakCallback && ( pDriverInfo->ptCallbacks ))
				{
					FREE_STDERR_COPY_ERR( pConfig_Install_CheckForBreakCallback( &pDriverInfo->InstrumentHandle , (pDriverInfo->ptCallbacks)->fCheckForBreakCallback , (pDriverInfo->ptCallbacks)->pCheckForBreakCallbackData , (pDriverInfo->ptCallbacks)->breakType ));
				}
			}
		
			if (pDriverInfo->ptCallbacks)
				pDriverInfo->bDemoMode = (pDriverInfo->ptCallbacks)->bDemoMode;
			//=================================================================================================================================//
		
			for ( iTry = 0 ; iTry < 3 ; iTry++ )
			{
				if ( pDriverInfo->bDemoMode == 1 )
				{
					pDriverInfo->bConnected = 1;
					break;
				}
			
				if ( pWrapperFunction )
				{
					FREE_STDERR_COPY( pWrapperFunction( pDriverInfo->InstrumentHandle , pszAddressString , &pDriverInfo->InstrumentHandle , &pDriverInfo->bConnected , &pDriverInfo->ChannelQuantity )); 
				}
				else
					break;
			
				if ( StdError.error )
					if ( ShowMessage ( INSTR_TYPE_YES_NO , "Function Genrator Error !!!", "Check connection and Power On the Device." , NULL ) )
						continue;
			
				break;
			}
		
			CHK_STDERR(StdError);
		
			if (pDriverInfo->bConnected == 0)
				{STD_ERR (DRV_ERROR_CONNECTION);}
	
			if ( !bHandleExists ) 
				DRIVER_MANAGER_UpdateConnection( pszAddressString , pDriverInfo->InstrumentHandle , NULL );
		
		} while (0);
	}
	else
	{
		pfSTD_Equipment_IsSupported					pWrapperFunction							=	NULL;
		int											iCount										=	0, 
													status										=	0, 
													bSupport									=	0, 
													defaultRM									=	0,
													hConnectionHandle							=	0;
		char										szReadBuffer[LOW_STRING]					=	{0};
		//------------------ Checking for driver supporting ------------------------//
		
		viOpenDefaultRM (&defaultRM);

		SetBreakOnLibraryErrors (0);
		
		status = viOpen ( defaultRM , pszAddressString , NULL, NULL, &hConnectionHandle );
		
		if ( status == 0 )
		{	
			status = viPrintf ( hConnectionHandle , "*IDN?\n" );
		
			if ( status == 0 )
			{
				viRead ( hConnectionHandle , szReadBuffer , (LOW_STRING-1) , &iCount );
			}
		}
		
		if ( hConnectionHandle )
			viClose(hConnectionHandle); 
		
		SetBreakOnLibraryErrors (1);  
		
		LibraryHandle = LoadLibrary(szDriverLocation);
		
		if ( LibraryHandle == 0 )
		{
			sprintf( szMessage , "Loading Driver File\n\"%s\"\n\nFailed, File corrupted." , szDriverLocation );
			ShowMessage ( INSTR_TYPE_CONTINUE , "Equipment driver file error..." , szMessage , NULL );
		
			FORCE_ERR(-6,szMessage);
		}
		
		pWrapperFunction = (pfSTD_Equipment_IsSupported) GetProcAddress( LibraryHandle , "Equipment_IsSupported");   
	
		if ( pWrapperFunction )
		{
			FREE_STDERR_COPY_ERR( pWrapperFunction( 0, pszAddressString , NULL , szReadBuffer , &bSupport , NULL )); 
			
			IF (( bSupport == 0 ) , "This driver is not support the current Equipment." );
		}
		else
		{
			char	szMessage[LOW_STRING]	= {0};
		
			sprintf( szMessage , "Method \"%s\"\nis not implemented in driver:\n%s" , "Equipment_IsSupported" , szDriverLocation );
		
			ShowMessage ( INSTR_TYPE_CONTINUE , "Implementation Error . . ." , szMessage , NULL );
		}			
	}
	
Error:
	
	if ( LibraryHandle )
		FreeLibrary(LibraryHandle); 

	if ( LockHandle && bLocked ) 
		CmtReleaseLock (LockHandle);
	
	if ( VariableHandle ) 
		CmtReleaseTSVPtr ( VariableHandle );

	if ( StdError.error )
	{
		DRV_FunctionGenerator_GetErrorTextMessage ( VariableHandle , StdError.error , &pTempString );
		
		if ( pTempString && ( strlen(pTempString)))
		{
			SET_DESCRIPTION(pTempString);
		}
		
		FREE(pTempString);
		DRV_FunctionGenerator_Close( &VariableHandle ); 
		
		if ( pHandle )
			*pHandle = 0;
	}
	
	return StdError;
}
Ejemplo n.º 7
0
//<export/import> [zParams]
void shell_xpot(int argc, TCHAR* argv[])
{
  int rc;
  int nDone = 0;
  int isExport = 0;
  TCHAR* zParams;
  TCHAR zSwapFile[MAX_PATH];

  enum {
    queueBufferSize = 4096*8,
  };
  char queueBuffer[queueBufferSize];
  TransportParams* pParams;
  Transporter transporter;

  do {
    //(1) get input args
    if (argc < 2) break;
    if (_tcscmp(argv[1], TEXT("export")) == 0) {
      zParams = MULTI_PATHS_ZEXPORT;
      isExport = TRUE;
    }
    else if (_tcscmp(argv[1], TEXT("import")) == 0) {
      zParams = MULTI_PATHS_ZIMPPORT;
      isExport = FALSE;
    } else
      break;
    if (argc == 3) zParams = argv[2];
    nDone = 1;
    //(2) init params
    GetModuleDir(zSwapFile, MAX_PATH);
    pathMng path;
    path.pathPush(zSwapFile, MAX_PATH, TEXT("\\fs.bin"));
    pParams = transporter.TransportDataInit(
      isExport,
      queueBuffer,
      queueBufferSize,
      zSwapFile,
      zParams
      );
    rc = transporter.Init(pParams);
    if (rc) break;
    transporter.Start();
    for (int i = 0;;i++) {
      TransportStatus status;
      transporter.GetStatus(&status);
      _tprintf(TEXT("status %d expl %I64d xpot %I64d\n"), status.stateFlags, status.exploredSize, status.xportedSize);
      if (status.stateFlags & TransportStatus::xportingComplete)
        break;
#if (1)
      Sleep(500);
#else //test interrupt
      Sleep(50);
      if (i==1) {
        transporter.Cancel();
      }
#endif
    }
    transporter.Final();
    nDone = 2;
  } while(FALSE);

  switch (nDone) {
    case 2:
      break;
    case 1:
      _tprintf(TEXT("init fail\n"));
      break;
    default:
      assert(nDone == 0);
      _tprintf(TEXT("<export/import> [zParams]\n"));
      break;
  }
}