Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2556 lines
65 KiB

  1. /* CFaxApiFunctionParameterInfo class implementation file. */
  2. #include "StdAfx.h"
  3. #include "param.h"
  4. extern "C" {
  5. #include "winfax.h"
  6. }
  7. //#include "winfax.h"
  8. /*
  9. * CFaxApiFunctionParameterInfo
  10. *
  11. * Purpose:
  12. * This function constructs a CFaxApiFunctionParameterInfo object.
  13. *
  14. * Arguments:
  15. * None
  16. *
  17. * Returns:
  18. * None
  19. *
  20. */
  21. CFaxApiFunctionParameterInfo::CFaxApiFunctionParameterInfo()
  22. {
  23. m_cpaParameterValue.RemoveAll();
  24. m_cpaParameterRange1.RemoveAll();
  25. m_cpaParameterRange2.RemoveAll();
  26. m_xNumberOfParameters = 0;
  27. }
  28. /*
  29. * ~CFaxApiFunctionParameterInfo
  30. *
  31. * Purpose:
  32. * This function destroys a CFaxApiFunctionParameterInfo object.
  33. *
  34. * Arguments:
  35. * None
  36. *
  37. * Returns:
  38. * None
  39. *
  40. */
  41. CFaxApiFunctionParameterInfo::~CFaxApiFunctionParameterInfo()
  42. {
  43. int xNumberOfElements;
  44. int xItemIndex;
  45. xNumberOfElements = m_cpaParameterValue.GetSize();
  46. if ( xNumberOfElements > 0 )
  47. {
  48. for ( xItemIndex = 0; xItemIndex < xNumberOfElements; xItemIndex++ )
  49. {
  50. if ( m_cpaParameterValue[xItemIndex] != (void *) NULL )
  51. {
  52. delete m_cpaParameterValue[xItemIndex];
  53. }
  54. }
  55. }
  56. xNumberOfElements = m_cpaParameterRange1.GetSize();
  57. if ( xNumberOfElements > 0 )
  58. {
  59. for ( xItemIndex = 0; xItemIndex < xNumberOfElements; xItemIndex++ )
  60. {
  61. if ( m_cpaParameterRange1[xItemIndex] != (void *) NULL )
  62. {
  63. delete m_cpaParameterRange1[xItemIndex];
  64. }
  65. }
  66. }
  67. xNumberOfElements = m_cpaParameterRange2.GetSize();
  68. if ( xNumberOfElements > 0 )
  69. {
  70. for ( xItemIndex = 0; xItemIndex < xNumberOfElements; xItemIndex++ )
  71. {
  72. if ( m_cpaParameterRange2[xItemIndex] != (void *) NULL )
  73. {
  74. delete m_cpaParameterRange2[xItemIndex];
  75. }
  76. }
  77. }
  78. }
  79. /*
  80. * InitParameterInfoMember
  81. *
  82. * Purpose:
  83. * This function constructs a CFaxApiFunctionParameterInfo object.
  84. *
  85. * Arguments:
  86. * rcsFunctionName - a reference to a CString tha contains the
  87. * name of a Fax API function.
  88. *
  89. * Returns:
  90. * None
  91. *
  92. */
  93. void CFaxApiFunctionParameterInfo::InitParameterInfoMember( const CString & rcsFunctionName )
  94. {
  95. m_cpaParameterValue.RemoveAll();
  96. m_cpaParameterRange1.RemoveAll();
  97. m_cpaParameterRange2.RemoveAll();
  98. /* Get the number of parameters from the initialization file. */
  99. int xNumberOfParameters;
  100. xNumberOfParameters = (int) GetPrivateProfileInt(
  101. (LPCTSTR) rcsFunctionName,
  102. (LPCTSTR) TEXT("NumberOfParameters"),
  103. -1, // default return value
  104. (LPCTSTR) TEXT(".\\faxapi.ini") );
  105. if ( xNumberOfParameters > 0 )
  106. {
  107. m_xNumberOfParameters = xNumberOfParameters;
  108. /* Initialize the sizes of the CStringArray data members. */
  109. m_csaParameterName.SetSize( m_xNumberOfParameters );
  110. m_csaParameterDescription.SetSize( m_xNumberOfParameters );
  111. /* Initialize the size of the CUIntArray data member. */
  112. m_cuiaParameterTypeEnum.SetSize( m_xNumberOfParameters );
  113. /* Initialize the sizes of the CPtrArray data members. */
  114. m_cpaParameterValue.SetSize( m_xNumberOfParameters );
  115. m_cpaParameterRange1.SetSize( m_xNumberOfParameters );
  116. m_cpaParameterRange2.SetSize( m_xNumberOfParameters );
  117. /************************************************************************/
  118. /* Read the parameter names, types, and descriptions from the ini file. */
  119. /************************************************************************/
  120. CString csParameterName;
  121. CString csParameterType;
  122. CString csParameterDescription;
  123. eParamType eParameterType;
  124. CString csKeyName;
  125. int xParameterIndex;
  126. DWORD dwGPPSrv; // returned by GetPrivateProfileString
  127. TCHAR tszProfileString[MAX_PARAM_VALUE_STRING_LENGTH]; // arbitrarily set size
  128. DWORD dwErrorCode;
  129. for ( xParameterIndex = 0; xParameterIndex < xNumberOfParameters; xParameterIndex++ )
  130. {
  131. /* Make the key for the parameter name. */
  132. csKeyName.Format( TEXT("ParameterName%d"), xParameterIndex );
  133. /* Read the parameter name. */
  134. dwGPPSrv = GetPrivateProfileString( (LPCTSTR) rcsFunctionName,
  135. (LPCTSTR) csKeyName,
  136. (LPCTSTR) TEXT("NULL"),
  137. (LPTSTR) tszProfileString,
  138. (DWORD) sizeof( tszProfileString ),
  139. (LPCTSTR) TEXT(".\\faxapi.ini") );
  140. /* Did GetPrivateProfileString return the string "NULL" ? */
  141. if ( _wcsicmp( tszProfileString, TEXT("NULL") ) != 0 )
  142. {
  143. /* Did GetPrivateProfileString read an entry ? */
  144. if ( dwGPPSrv > (DWORD) 0L )
  145. {
  146. csParameterName = (CString) tszProfileString;
  147. try
  148. {
  149. m_csaParameterName.SetAt( xParameterIndex, csParameterName );
  150. }
  151. catch ( ... )
  152. {
  153. dwErrorCode = GetLastError();
  154. if ( dwErrorCode == (DWORD) NO_ERROR )
  155. {
  156. dwErrorCode = (DWORD) ERROR_NOT_ENOUGH_MEMORY;
  157. }
  158. }
  159. }
  160. }
  161. /* Make the key for the parameter type. */
  162. csKeyName.Format( TEXT("ParameterType%d"), xParameterIndex );
  163. /* Read the parameter name. */
  164. dwGPPSrv = GetPrivateProfileString( (LPCTSTR) rcsFunctionName,
  165. (LPCTSTR) csKeyName,
  166. (LPCTSTR) TEXT("NULL"),
  167. (LPTSTR) tszProfileString,
  168. (DWORD) sizeof( tszProfileString ),
  169. (LPCTSTR) TEXT(".\\faxapi.ini") );
  170. /* Did GetPrivateProfileString return the string "NULL" ? */
  171. if ( _wcsicmp( tszProfileString, TEXT("NULL") ) != 0 )
  172. {
  173. /* Did GetPrivateProfileString read an entry ? */
  174. if ( dwGPPSrv > (DWORD) 0L )
  175. {
  176. csParameterType = (CString) tszProfileString;
  177. eParameterType = GetParameterTypeEnum( (CString &) csParameterType );
  178. try
  179. {
  180. m_cuiaParameterTypeEnum.SetAt( xParameterIndex, (UINT) eParameterType );
  181. }
  182. catch ( ... )
  183. {
  184. dwErrorCode = GetLastError();
  185. if ( dwErrorCode == (DWORD) NO_ERROR )
  186. {
  187. dwErrorCode = (DWORD) ERROR_NOT_ENOUGH_MEMORY;
  188. }
  189. }
  190. // Terminate the for loop on error ?
  191. /* Allocate Storage for the parameter value. */
  192. m_cpaParameterValue[xParameterIndex] =
  193. AllocateStorageForParameterEntity( eParameterType );
  194. }
  195. }
  196. /* Make the key for the parameter description. */
  197. csKeyName.Format( TEXT("ParameterDescr%d"), xParameterIndex );
  198. /* Read the parameter name. */
  199. dwGPPSrv = GetPrivateProfileString( (LPCTSTR) rcsFunctionName,
  200. (LPCTSTR) csKeyName,
  201. (LPCTSTR) TEXT("NULL"),
  202. (LPTSTR) tszProfileString,
  203. (DWORD) sizeof( tszProfileString ),
  204. (LPCTSTR) TEXT(".\\faxapi.ini") );
  205. /* Did GetPrivateProfileString return the string "NULL" ? */
  206. if ( _wcsicmp( tszProfileString, TEXT("NULL") ) != 0 )
  207. {
  208. /* Did GetPrivateProfileString read an entry ? */
  209. if ( dwGPPSrv > (DWORD) 0L )
  210. {
  211. csParameterDescription = (CString) tszProfileString;
  212. try
  213. {
  214. m_csaParameterDescription.SetAt( xParameterIndex, csParameterDescription );
  215. }
  216. catch ( ... )
  217. {
  218. dwErrorCode = GetLastError();
  219. if ( dwErrorCode == (DWORD) NO_ERROR )
  220. {
  221. dwErrorCode = (DWORD) ERROR_NOT_ENOUGH_MEMORY;
  222. }
  223. }
  224. }
  225. }
  226. // Will need to handle the parameter range(s) later !
  227. } // end of for loop
  228. }
  229. else
  230. {
  231. m_xNumberOfParameters = 0;
  232. }
  233. }
  234. /*
  235. * AllocateStorageForParameterEntity
  236. *
  237. * Purpose:
  238. * This function allocates (via the new operator) storage for either
  239. * a parameter value or range entity.
  240. *
  241. * Arguments:
  242. * eParameterType - indicates the type of the parameter
  243. *
  244. * Returns:
  245. * a pointer to the storage that was allocated.
  246. *
  247. */
  248. void * CFaxApiFunctionParameterInfo::AllocateStorageForParameterEntity( eParamType eParameterType )
  249. {
  250. void * pvParameterStorage;
  251. CString csMessage;
  252. /* As of 6/11/97, there are 22 types of parameters. */
  253. switch ( eParameterType )
  254. {
  255. case eBOOL:
  256. /* The parameter type is BOOL. */
  257. pvParameterStorage = (void *) new BOOL;
  258. *((BOOL *) pvParameterStorage) = (BOOL) FALSE;
  259. break;
  260. case eDWORD:
  261. /* The parameter type is DWORD. */
  262. pvParameterStorage = (void *) new DWORD;
  263. *((DWORD *) pvParameterStorage) = (DWORD) 0L;
  264. break;
  265. case eHANDLE:
  266. /* The parameter type is HANDLE. */
  267. pvParameterStorage = (void *) new HANDLE;
  268. *((HANDLE *) pvParameterStorage) = (HANDLE) INVALID_HANDLE_VALUE;
  269. break;
  270. case eHDC:
  271. /* The parameter type is HDC. */
  272. pvParameterStorage = (void *) new HDC;
  273. *((HDC *) pvParameterStorage) = (HDC) INVALID_HANDLE_VALUE;
  274. break;
  275. case ePHDC:
  276. /* The parameter type is HDC *. */
  277. pvParameterStorage = (void *) new HDC *;
  278. *((HDC * *) pvParameterStorage) = (HDC *) NULL;
  279. break;
  280. case eLPBYTE:
  281. /* The parameter type is LPBYTE. */
  282. pvParameterStorage = (void *) new LPBYTE;
  283. *((LPBYTE *) pvParameterStorage) = (LPBYTE) NULL;
  284. break;
  285. case ePLPBYTE:
  286. /* The parameter type is LPBYTE *. */
  287. pvParameterStorage = (void *) new LPBYTE *;
  288. *((LPBYTE * *) pvParameterStorage) = (LPBYTE *) NULL;
  289. break;
  290. case eLPDWORD:
  291. /* The parameter type is LPDWORD. */
  292. pvParameterStorage = (void *) new LPDWORD;
  293. *((LPDWORD *) pvParameterStorage) = (LPDWORD) NULL;
  294. break;
  295. case eLPHANDLE:
  296. /* The parameter type is LPHANDLE. */
  297. pvParameterStorage = (void *) new LPHANDLE;
  298. *((LPHANDLE *) pvParameterStorage) = (LPHANDLE) NULL;
  299. break;
  300. case eLPSTR:
  301. /* The parameter type is LPSTR. */
  302. pvParameterStorage = (void *) new char[MAX_PARAM_VALUE_STRING_LENGTH]; // arbitrary size !
  303. /* Intialize it to an empty string. */
  304. *((char *) pvParameterStorage) = (char) '\0';
  305. break;
  306. case eLPVOID:
  307. /* The parameter type is LPVOID. */
  308. pvParameterStorage = (void *) new LPVOID;
  309. *((LPVOID *) pvParameterStorage) = (LPVOID) NULL;
  310. break;
  311. case eLPWSTR:
  312. /* The parameter type is LPWSTR. */
  313. pvParameterStorage = (void *) new wchar_t[MAX_PARAM_VALUE_STRING_LENGTH]; // arbitrary size
  314. /* Initialize it to an empty string. */
  315. *((wchar_t *) pvParameterStorage) = (wchar_t) L'\0';
  316. break;
  317. case ePFAX_CONFIGURATIONA:
  318. /* The parameter type is PFAX_CONFIGURATIONA. */
  319. pvParameterStorage = (void *) new PFAX_CONFIGURATIONA;
  320. *((PFAX_CONFIGURATIONA *) pvParameterStorage) = (PFAX_CONFIGURATIONA) NULL;
  321. break;
  322. case ePPFAX_CONFIGURATIONA:
  323. /* The parameter type is PFAX_CONFIGURATIONA *. */
  324. pvParameterStorage = (void *) new PFAX_CONFIGURATIONA *;
  325. *((PFAX_CONFIGURATIONA * *) pvParameterStorage) = (PFAX_CONFIGURATIONA *) NULL;
  326. break;
  327. case ePFAX_CONFIGURATIONW:
  328. /* The parameter type is PFAX_CONFIGURATIONW. */
  329. pvParameterStorage = (void *) new PFAX_CONFIGURATIONW;
  330. *((PFAX_CONFIGURATIONW *) pvParameterStorage) = (PFAX_CONFIGURATIONW) NULL;
  331. break;
  332. case ePPFAX_CONFIGURATIONW:
  333. /* The parameter type is PFAX_CONFIGURATIONW *. */
  334. pvParameterStorage = (void *) new PFAX_CONFIGURATIONW *;
  335. *((PFAX_CONFIGURATIONW * *) pvParameterStorage) = (PFAX_CONFIGURATIONW *) NULL;
  336. break;
  337. case ePFAX_COVERPAGE_INFOA:
  338. /* The parameter type is PFAX_COVERPAGE_INFOA. */
  339. pvParameterStorage = (void *) new PFAX_COVERPAGE_INFOA;
  340. *((PFAX_COVERPAGE_INFOA *) pvParameterStorage) = (PFAX_COVERPAGE_INFOA) NULL;
  341. break;
  342. case ePFAX_COVERPAGE_INFOW:
  343. /* The parameter type is PFAX_COVERPAGE_INFOW. */
  344. pvParameterStorage = (void *) new PFAX_COVERPAGE_INFOW;
  345. *((PFAX_COVERPAGE_INFOW *) pvParameterStorage) = (PFAX_COVERPAGE_INFOW) NULL;
  346. break;
  347. case ePPFAX_DEVICE_STATUSA:
  348. /* The parameter type is PFAX_DEVICE_STATUSA *. */
  349. pvParameterStorage = (void *) new PFAX_DEVICE_STATUSA *;
  350. *((PFAX_DEVICE_STATUSA * *) pvParameterStorage) = (PFAX_DEVICE_STATUSA *) NULL;
  351. break;
  352. case ePPFAX_DEVICE_STATUSW:
  353. /* The parameter type is PFAX_DEVICE_STATUSW *. */
  354. pvParameterStorage = (void *) new PFAX_DEVICE_STATUSW *;
  355. *((PFAX_DEVICE_STATUSW * *) pvParameterStorage) = (PFAX_DEVICE_STATUSW *) NULL;
  356. break;
  357. case ePFAX_JOB_ENTRYA:
  358. /* The parameter type is PFAX_JOB_ENTRYA. */
  359. pvParameterStorage = (void *) new PFAX_JOB_ENTRYA;
  360. *((PFAX_JOB_ENTRYA *) pvParameterStorage) = (PFAX_JOB_ENTRYA) NULL;
  361. break;
  362. case ePPFAX_JOB_ENTRYA:
  363. /* The parameter type is PFAX_JOB_ENTRYA *. */
  364. pvParameterStorage = (void *) new PFAX_JOB_ENTRYA *;
  365. *((PFAX_JOB_ENTRYA * *) pvParameterStorage) = (PFAX_JOB_ENTRYA *) NULL;
  366. break;
  367. case ePFAX_JOB_ENTRYW:
  368. /* The parameter type is PFAX_JOB_ENTRYW. */
  369. pvParameterStorage = (void *) new PFAX_JOB_ENTRYW;
  370. *((PFAX_JOB_ENTRYW *) pvParameterStorage) = (PFAX_JOB_ENTRYW) NULL;
  371. break;
  372. case ePPFAX_JOB_ENTRYW:
  373. /* The parameter type is PFAX_JOB_ENTRYW *. */
  374. pvParameterStorage = (void *) new PFAX_JOB_ENTRYW *;
  375. *((PFAX_JOB_ENTRYW * *) pvParameterStorage) = (PFAX_JOB_ENTRYW *) NULL;
  376. break;
  377. case ePFAX_JOB_PARAMA:
  378. /* The parameter type is PFAX_JOB_PARAMA. */
  379. pvParameterStorage = (void *) new PFAX_JOB_PARAMA;
  380. *((PFAX_JOB_PARAMA *) pvParameterStorage) = (PFAX_JOB_PARAMA) NULL;
  381. break;
  382. case ePFAX_JOB_PARAMW:
  383. /* The parameter type is PFAX_JOB_PARAMW. */
  384. pvParameterStorage = (void *) new PFAX_JOB_PARAMW;
  385. *((PFAX_JOB_PARAMW *) pvParameterStorage) = (PFAX_JOB_PARAMW) NULL;
  386. break;
  387. case ePFAX_LOG_CATEGORY:
  388. /* The parameter type is PFAX_LOG_CATEGORY. */
  389. pvParameterStorage = (void *) new PFAX_LOG_CATEGORY;
  390. *((PFAX_LOG_CATEGORY *) pvParameterStorage) = (PFAX_LOG_CATEGORY) NULL;
  391. break;
  392. case ePPFAX_LOG_CATEGORY:
  393. /* The parameter type is PFAX_LOG_CATEGORY *. */
  394. pvParameterStorage = (void *) new PFAX_LOG_CATEGORY *;
  395. *((PFAX_LOG_CATEGORY * *) pvParameterStorage) = (PFAX_LOG_CATEGORY *) NULL;
  396. break;
  397. case ePFAX_PORT_INFOA:
  398. /* The parameter type is PFAX_PORT_INFOA. */
  399. pvParameterStorage = (void *) new PFAX_PORT_INFOA;
  400. *((PFAX_PORT_INFOA *) pvParameterStorage) = (PFAX_PORT_INFOA) NULL;
  401. break;
  402. case ePPFAX_PORT_INFOA:
  403. /* The parameter type is PFAX_PORT_INFOA *. */
  404. pvParameterStorage = (void *) new PFAX_PORT_INFOA *;
  405. *((PFAX_PORT_INFOA * *) pvParameterStorage) = (PFAX_PORT_INFOA *) NULL;
  406. break;
  407. case ePFAX_PORT_INFOW:
  408. /* The parameter type is PFAX_PORT_INFOW. */
  409. pvParameterStorage = (void *) new PFAX_PORT_INFOW;
  410. *((PFAX_PORT_INFOW *) pvParameterStorage) = (PFAX_PORT_INFOW) NULL;
  411. break;
  412. case ePPFAX_PORT_INFOW:
  413. /* The parameter type is PFAX_PORT_INFOW *. */
  414. pvParameterStorage = (void *) new PFAX_PORT_INFOW *;
  415. *((PFAX_PORT_INFOW * *) pvParameterStorage) = (PFAX_PORT_INFOW *) NULL;
  416. break;
  417. case ePFAX_PRINT_INFOA:
  418. /* The parameter type is PFAX_PRINT_INFOA. */
  419. pvParameterStorage = (void *) new PFAX_PRINT_INFOA;
  420. *((PFAX_PRINT_INFOA *) pvParameterStorage) = (PFAX_PRINT_INFOA) NULL;
  421. break;
  422. case ePFAX_PRINT_INFOW:
  423. /* The parameter type is PFAX_PRINT_INFOW. */
  424. pvParameterStorage = (void *) new PFAX_PRINT_INFOW;
  425. *((PFAX_PRINT_INFOW *) pvParameterStorage) = (PFAX_PRINT_INFOW) NULL;
  426. break;
  427. case ePPFAX_ROUTING_METHODA:
  428. /* The parameter type is PFAX_ROUTING_METHODA *. */
  429. pvParameterStorage = (void *) new PFAX_ROUTING_METHODA *;
  430. *((PFAX_ROUTING_METHODA * *) pvParameterStorage) = (PFAX_ROUTING_METHODA *) NULL;
  431. break;
  432. case ePPFAX_ROUTING_METHODW:
  433. /* The parameter type is PFAX_ROUTING_METHODW *. */
  434. pvParameterStorage = (void *) new PFAX_ROUTING_METHODW *;
  435. *((PFAX_ROUTING_METHODW * *) pvParameterStorage) = (PFAX_ROUTING_METHODW *) NULL;
  436. break;
  437. default:
  438. /* The parameter type was not one of the cases above. */
  439. csMessage.Format( TEXT("Unrecognized type in AllocateStorageForParameterEntity") );
  440. AfxMessageBox( csMessage );
  441. pvParameterStorage = (void *) NULL;
  442. }
  443. return ( pvParameterStorage );
  444. }
  445. /*
  446. * GetNumberOfParameters
  447. *
  448. * Purpose:
  449. * This function retrieves the m_xNumberOfParameters member of the
  450. * CFaxApiFunctionParameterInfo object.
  451. *
  452. * Arguments:
  453. * None
  454. *
  455. * Returns:
  456. * The number of parameters
  457. *
  458. */
  459. int CFaxApiFunctionParameterInfo::GetNumberOfParameters()
  460. {
  461. return ( m_xNumberOfParameters );
  462. }
  463. /*
  464. * GetParameterName
  465. *
  466. * Purpose:
  467. * This function retrieves the Name of a parameter from the
  468. * CFaxApiFunctionParameterInfo object.
  469. *
  470. * Arguments:
  471. * xParameterIndex - the index to the parameter
  472. *
  473. * Returns:
  474. * A CString that contains the parameter name.
  475. *
  476. */
  477. CString CFaxApiFunctionParameterInfo::GetParameterName( int xParameterIndex )
  478. {
  479. return ( (CString) m_csaParameterName.GetAt( xParameterIndex ) );
  480. }
  481. /*
  482. * GetParameterValuePointer
  483. *
  484. * Purpose:
  485. * This function retrieves the pointer to the storage for the
  486. * parameter value.
  487. *
  488. * Arguments:
  489. * xParameterIndex = the index into the CPtrArray object to the
  490. * element that points to the parameter value.
  491. *
  492. * Returns:
  493. * a pointer to the storage for the parameter value.
  494. *
  495. */
  496. void * CFaxApiFunctionParameterInfo::GetParameterValuePointer( int xParameterIndex )
  497. {
  498. void * pvParameterValue;
  499. pvParameterValue = m_cpaParameterValue[xParameterIndex];
  500. return ( pvParameterValue );
  501. }
  502. /*
  503. * FormatParameterValueForOutput
  504. *
  505. * Purpose:
  506. * This function prepares a CString representation of the parameter
  507. * value whose index is xParameterIndex.
  508. *
  509. * Arguments:
  510. * xParameterIndex = the index to the parameter value to be output.
  511. * rcsParameterValue - a reference to the CString to receive the string
  512. * representation of the parameter value.
  513. *
  514. * Returns:
  515. * None
  516. *
  517. */
  518. void CFaxApiFunctionParameterInfo::FormatParameterValueForOutput( int xParameterIndex, CString & rcsParameterValue )
  519. {
  520. /* Get the parameter type. */
  521. eParamType eParameterType;
  522. eParameterType = GetParameterTypeEnum( xParameterIndex );
  523. /* Get a pointer to the storage for the parameter. */
  524. void * pvParameterValue;
  525. pvParameterValue = GetParameterValuePointer( xParameterIndex );
  526. /* As of 6/11/97, there are 22 types of parameters. */
  527. switch ( eParameterType )
  528. {
  529. case eBOOL:
  530. {
  531. /* The parameter type is BOOL. */
  532. if ( (BOOL) *((BOOL *) pvParameterValue) == (BOOL) FALSE )
  533. {
  534. rcsParameterValue = (CString) TEXT("FALSE");
  535. }
  536. else
  537. {
  538. rcsParameterValue = (CString) TEXT("TRUE");
  539. }
  540. }
  541. break;
  542. case eDWORD:
  543. {
  544. /* The parameter type is DWORD. */
  545. rcsParameterValue.Format( TEXT("0x%x"),
  546. (DWORD) *((DWORD *) pvParameterValue) );
  547. }
  548. break;
  549. case eHANDLE:
  550. {
  551. /* The parameter type is HANDLE. */
  552. rcsParameterValue.Format( TEXT("0x%x"),
  553. (HANDLE) *((HANDLE *) pvParameterValue) );
  554. }
  555. break;
  556. case eHDC:
  557. {
  558. /* The parameter type is HDC. */
  559. rcsParameterValue.Format( TEXT("0x%x"),
  560. (HDC) *((HDC *) pvParameterValue) );
  561. }
  562. break;
  563. case ePHDC:
  564. {
  565. /* The parameter type is HDC *. */
  566. rcsParameterValue.Format( TEXT("0x%x"), (HDC *) *((HDC * *) pvParameterValue) );
  567. }
  568. break;
  569. case eLPBYTE:
  570. {
  571. /* The parameter type is LPBYTE. */
  572. rcsParameterValue.Format( TEXT("0x%x"), (LPBYTE) *((LPBYTE) pvParameterValue) );
  573. }
  574. break;
  575. case ePLPBYTE:
  576. {
  577. /* The parameter type is LPBYTE *. */
  578. rcsParameterValue.Format( TEXT("0x%x"),
  579. (LPBYTE *)
  580. *((LPBYTE * *) pvParameterValue) );
  581. }
  582. break;
  583. case eLPDWORD:
  584. {
  585. /* The parameter type is LPDWORD. */
  586. rcsParameterValue.Format( TEXT("0x%x"),
  587. (LPDWORD)
  588. *((LPDWORD *) pvParameterValue) );
  589. }
  590. break;
  591. case eLPHANDLE:
  592. {
  593. /* The parameter type is LPHANDLE. */
  594. rcsParameterValue.Format( TEXT("0x%x"),
  595. (LPHANDLE)
  596. *((LPHANDLE *) pvParameterValue) );
  597. }
  598. break;
  599. case eLPSTR:
  600. {
  601. /* The parameter type is LPSTR. */
  602. LPSTR pszParameterValue;
  603. pszParameterValue = (LPSTR) pvParameterValue;
  604. /* Convert the ANSI string to UNICODE. */
  605. size_t t_AnsiStringLength;
  606. t_AnsiStringLength = strlen( pszParameterValue );
  607. LPWSTR pwszParameterValue;
  608. pwszParameterValue = new wchar_t[t_AnsiStringLength+1]; // reserve space for the terminator
  609. if ( pwszParameterValue != (LPWSTR) NULL )
  610. {
  611. int xNumberOfCharsConverted;
  612. xNumberOfCharsConverted = mbstowcs( pwszParameterValue,
  613. pszParameterValue,
  614. t_AnsiStringLength );
  615. /* Terminate the wide character string. */
  616. pwszParameterValue[xNumberOfCharsConverted] = (wchar_t) L'\0';
  617. rcsParameterValue.Format( TEXT("%s"), (LPTSTR) pwszParameterValue );
  618. delete pwszParameterValue;
  619. }
  620. }
  621. break;
  622. case eLPVOID:
  623. {
  624. /* The parameter type is LPVOID. */
  625. rcsParameterValue.Format( TEXT("0x%x"),
  626. (LPVOID) *((LPVOID *) pvParameterValue) );
  627. }
  628. break;
  629. case eLPWSTR:
  630. {
  631. /* The parameter type is LPWSTR. */
  632. rcsParameterValue.Format( TEXT("%s"),
  633. (LPTSTR) (LPWSTR) pvParameterValue );
  634. }
  635. break;
  636. case ePFAX_CONFIGURATIONA:
  637. {
  638. /* The parameter type is PFAX_CONFIGURATIONA. */
  639. rcsParameterValue.Format( TEXT("0x%x"),
  640. (PFAX_CONFIGURATIONA)
  641. *((PFAX_CONFIGURATIONA *) pvParameterValue) );
  642. }
  643. break;
  644. case ePPFAX_CONFIGURATIONA:
  645. {
  646. /* The parameter type is PFAX_CONFIGURATIONA *. */
  647. rcsParameterValue.Format( TEXT("0x%x"),
  648. (PFAX_CONFIGURATIONA *)
  649. *((PFAX_CONFIGURATIONA * *) pvParameterValue) );
  650. }
  651. break;
  652. case ePFAX_CONFIGURATIONW:
  653. {
  654. /* The parameter type is PFAX_CONFIGURATIONW. */
  655. rcsParameterValue.Format( TEXT("0x%x"),
  656. (PFAX_CONFIGURATIONW)
  657. *((PFAX_CONFIGURATIONW *) pvParameterValue) );
  658. }
  659. break;
  660. case ePPFAX_CONFIGURATIONW:
  661. {
  662. /* The parameter type is PFAX_CONFIGURATIONW *. */
  663. rcsParameterValue.Format( TEXT("0x%x"),
  664. (PFAX_CONFIGURATIONW *)
  665. *((PFAX_CONFIGURATIONW * *) pvParameterValue) );
  666. }
  667. break;
  668. case ePFAX_COVERPAGE_INFOA:
  669. {
  670. /* The parameter type is PFAX_COVERPAGE_INFOA. */
  671. rcsParameterValue.Format( TEXT("0x%x"),
  672. (PFAX_COVERPAGE_INFOA)
  673. *((PFAX_COVERPAGE_INFOA *) pvParameterValue) );
  674. }
  675. break;
  676. case ePFAX_COVERPAGE_INFOW:
  677. {
  678. /* The parameter type is PFAX_COVERPAGE_INFOW. */
  679. rcsParameterValue.Format( TEXT("0x%x"),
  680. (PFAX_COVERPAGE_INFOW)
  681. *((PFAX_COVERPAGE_INFOW *) pvParameterValue) );
  682. }
  683. break;
  684. case ePPFAX_DEVICE_STATUSA:
  685. {
  686. /* The parameter type is PFAX_DEVICE_STATUSA *. */
  687. rcsParameterValue.Format( TEXT("0x%x"),
  688. (PFAX_DEVICE_STATUSA *)
  689. *((PFAX_DEVICE_STATUSA * *) pvParameterValue) );
  690. }
  691. break;
  692. case ePPFAX_DEVICE_STATUSW:
  693. {
  694. /* The parameter type is PFAX_DEVICE_STATUSW *. */
  695. rcsParameterValue.Format( TEXT("0x%x"),
  696. (PFAX_DEVICE_STATUSW *)
  697. *((PFAX_DEVICE_STATUSW * *) pvParameterValue) );
  698. }
  699. break;
  700. case ePFAX_JOB_ENTRYA:
  701. {
  702. /* The parameter type is PFAX_JOB_ENTRYA. */
  703. rcsParameterValue.Format( TEXT("0x%x"),
  704. (PFAX_JOB_ENTRYA)
  705. *((PFAX_JOB_ENTRYA *) pvParameterValue) );
  706. }
  707. break;
  708. case ePPFAX_JOB_ENTRYA:
  709. {
  710. /* The parameter type is PFAX_JOB_ENTRYA *. */
  711. rcsParameterValue.Format( TEXT("0x%x"),
  712. (PFAX_JOB_ENTRYA *)
  713. *((PFAX_JOB_ENTRYA * *) pvParameterValue) );
  714. }
  715. break;
  716. case ePFAX_JOB_ENTRYW:
  717. {
  718. /* The parameter type is PFAX_JOB_ENTRYW. */
  719. rcsParameterValue.Format( TEXT("0x%x"),
  720. (PFAX_JOB_ENTRYW)
  721. *((PFAX_JOB_ENTRYW *) pvParameterValue) );
  722. }
  723. break;
  724. case ePPFAX_JOB_ENTRYW:
  725. {
  726. /* The parameter type is PFAX_JOB_ENTRYW *. */
  727. rcsParameterValue.Format( TEXT("0x%x"),
  728. (PFAX_JOB_ENTRYW *)
  729. *((PFAX_JOB_ENTRYW * *) pvParameterValue) );
  730. }
  731. break;
  732. case ePFAX_JOB_PARAMA:
  733. {
  734. /* The parameter type is PFAX_JOB_PARAMA. */
  735. rcsParameterValue.Format( TEXT("0x%x"),
  736. (PFAX_JOB_PARAMA)
  737. *((PFAX_JOB_PARAMA *) pvParameterValue) );
  738. }
  739. break;
  740. case ePFAX_JOB_PARAMW:
  741. {
  742. /* The parameter type is PFAX_JOB_PARAMW. */
  743. rcsParameterValue.Format( TEXT("0x%x"),
  744. (PFAX_JOB_PARAMW)
  745. *((PFAX_JOB_PARAMW *) pvParameterValue) );
  746. }
  747. break;
  748. case ePFAX_LOG_CATEGORY:
  749. {
  750. /* The parameter type is PFAX_LOG_CATEGORY. */
  751. rcsParameterValue.Format( TEXT("0x%x"),
  752. (PFAX_LOG_CATEGORY)
  753. *((PFAX_LOG_CATEGORY *) pvParameterValue) );
  754. }
  755. break;
  756. case ePPFAX_LOG_CATEGORY:
  757. {
  758. /* The parameter type is PFAX_LOG_CATEGORY *. */
  759. rcsParameterValue.Format( TEXT("0x%x"),
  760. (PFAX_LOG_CATEGORY *)
  761. *((PFAX_LOG_CATEGORY * *) pvParameterValue) );
  762. }
  763. break;
  764. case ePFAX_PORT_INFOA:
  765. {
  766. /* The parameter type is PFAX_PORT_INFOA. */
  767. rcsParameterValue.Format( TEXT("0x%x"),
  768. (PFAX_PORT_INFOA)
  769. *((PFAX_PORT_INFOA *) pvParameterValue) );
  770. }
  771. break;
  772. case ePPFAX_PORT_INFOA:
  773. {
  774. /* The parameter type is PFAX_PORT_INFOA *. */
  775. rcsParameterValue.Format( TEXT("0x%x"),
  776. (PFAX_PORT_INFOA *)
  777. *((PFAX_PORT_INFOA * *) pvParameterValue) );
  778. }
  779. break;
  780. case ePFAX_PORT_INFOW:
  781. {
  782. /* The parameter type is PFAX_PORT_INFOW. */
  783. rcsParameterValue.Format( TEXT("0x%x"),
  784. (PFAX_PORT_INFOW)
  785. *((PFAX_PORT_INFOW *) pvParameterValue) );
  786. }
  787. break;
  788. case ePPFAX_PORT_INFOW:
  789. {
  790. /* The parameter type is PFAX_PORT_INFOW *. */
  791. rcsParameterValue.Format( TEXT("0x%x"),
  792. (PFAX_PORT_INFOW *)
  793. *((PFAX_PORT_INFOW * *) pvParameterValue) );
  794. }
  795. break;
  796. case ePFAX_PRINT_INFOA:
  797. {
  798. /* The parameter type is PFAX_PRINT_INFOA. */
  799. rcsParameterValue.Format( TEXT("0x%x"),
  800. (PFAX_PRINT_INFOA)
  801. *((PFAX_PRINT_INFOA *) pvParameterValue) );
  802. }
  803. break;
  804. case ePFAX_PRINT_INFOW:
  805. {
  806. /* The parameter type is PFAX_PRINT_INFOW. */
  807. rcsParameterValue.Format( TEXT("0x%x"),
  808. (PFAX_PRINT_INFOW)
  809. *((PFAX_PRINT_INFOW *) pvParameterValue) );
  810. }
  811. break;
  812. case ePPFAX_ROUTING_METHODA:
  813. {
  814. /* The parameter type is PFAX_ROUTING_METHODA *. */
  815. rcsParameterValue.Format( TEXT("0x%x"),
  816. (PFAX_ROUTING_METHODA *)
  817. *((PFAX_ROUTING_METHODA * *) pvParameterValue) );
  818. }
  819. break;
  820. case ePPFAX_ROUTING_METHODW:
  821. {
  822. /* The parameter type is PFAX_ROUTING_METHODW *. */
  823. rcsParameterValue.Format( TEXT("0x%x"),
  824. (PFAX_ROUTING_METHODW *)
  825. *((PFAX_ROUTING_METHODW * *) pvParameterValue) );
  826. }
  827. break;
  828. default:
  829. {
  830. /* The parameter type was not one of the cases above. */
  831. CString csMessage;
  832. csMessage.Format( TEXT("Unrecognized type in FormatParameterValueForOutput") );
  833. AfxMessageBox( csMessage );
  834. rcsParameterValue.Empty();
  835. }
  836. }
  837. }
  838. /*
  839. * GetParameterTypeString
  840. *
  841. * Purpose:
  842. * This function retrieves the parameter type for the parameter whose
  843. * index is xParameterIndex.
  844. *
  845. * Arguments:
  846. * xParameterIndex = the index into the CPtrArray to the pointer
  847. * to the CFaxApiFunctionParameterInfo object.
  848. *
  849. * Returns:
  850. * A CString that contains the parameter type.
  851. *
  852. */
  853. CString CFaxApiFunctionParameterInfo::GetParameterTypeString( int xParameterIndex )
  854. {
  855. CString csParameterType;
  856. eParamType eParameterType;
  857. eParameterType = (eParamType) m_cuiaParameterTypeEnum.GetAt( xParameterIndex );
  858. switch ( eParameterType )
  859. {
  860. case eBOOL:
  861. /* The parameter type is BOOL. */
  862. csParameterType = (CString) TEXT("BOOL");
  863. break;
  864. case eDWORD:
  865. /* The parameter type is DWORD. */
  866. csParameterType = (CString) TEXT("DWORD");
  867. break;
  868. case eHANDLE:
  869. /* The parameter type is HANDLE. */
  870. csParameterType = (CString) TEXT("HANDLE");
  871. break;
  872. case eHDC:
  873. /* The parameter type is HDC. */
  874. csParameterType = (CString) TEXT("HDC");
  875. break;
  876. case ePHDC:
  877. /* The parameter type is HDC *. */
  878. csParameterType = (CString) TEXT("HDC *");
  879. break;
  880. case eLPBYTE:
  881. /* The parameter type is LPBYTE. */
  882. csParameterType = (CString) TEXT("LPBYTE");
  883. break;
  884. case ePLPBYTE:
  885. /* The parameter type is LPBYTE *. */
  886. csParameterType = (CString) TEXT("LPBYTE *");
  887. break;
  888. case eLPDWORD:
  889. /* The parameter type is LPDWORD. */
  890. csParameterType = (CString) TEXT("LPDWORD");
  891. break;
  892. case eLPHANDLE:
  893. /* The parameter type is LPHANDLE. */
  894. csParameterType = (CString) TEXT("LPHANDLE");
  895. break;
  896. case eLPSTR:
  897. /* The parameter type is LPSTR. */
  898. csParameterType = (CString) TEXT("LPSTR");
  899. break;
  900. case eLPVOID:
  901. /* The parameter type is LPVOID. */
  902. csParameterType = (CString) TEXT("LPVOID");
  903. break;
  904. case eLPWSTR:
  905. /* The parameter type is LPWSTR. */
  906. csParameterType = (CString) TEXT("LPWSTR");
  907. break;
  908. case ePFAX_CONFIGURATIONA:
  909. /* The parameter type is PFAX_CONFIGURATIONA. */
  910. csParameterType = (CString) TEXT("PFAX_CONFIGURATIONA");
  911. break;
  912. case ePPFAX_CONFIGURATIONA:
  913. /* The parameter type is PFAX_CONFIGURATIONA *. */
  914. csParameterType = (CString) TEXT("PFAX_CONFIGURATIONA *");
  915. break;
  916. case ePFAX_CONFIGURATIONW:
  917. /* The parameter type is PFAX_CONFIGURATIONW. */
  918. csParameterType = (CString) TEXT("PFAX_CONFIGURATIONW");
  919. break;
  920. case ePPFAX_CONFIGURATIONW:
  921. /* The parameter type is PFAX_CONFIGURATIONW *. */
  922. csParameterType = (CString) TEXT("PFAX_CONFIGURATIONW *");
  923. break;
  924. case ePFAX_COVERPAGE_INFOA:
  925. /* The parameter type is PFAX_COVERPAGE_INFOA. */
  926. csParameterType = (CString) TEXT("PFAX_COVERPAGE_INFOA");
  927. break;
  928. case ePFAX_COVERPAGE_INFOW:
  929. /* The parameter type is PFAX_COVERPAGE_INFOW. */
  930. csParameterType = (CString) TEXT("PFAX_COVERPAGE_INFOW");
  931. break;
  932. case ePPFAX_DEVICE_STATUSA:
  933. /* The parameter type is PFAX_DEVICE_STATUSA *. */
  934. csParameterType = (CString) TEXT("PFAX_DEVICE_STATUSA *");
  935. break;
  936. case ePPFAX_DEVICE_STATUSW:
  937. /* The parameter type is PFAX_DEVICE_STATUSW *. */
  938. csParameterType = (CString) TEXT("PFAX_DEVICE_STATUSW *");
  939. break;
  940. case ePFAX_JOB_ENTRYA:
  941. /* The parameter type is PFAX_JOB_ENTRYA. */
  942. csParameterType = (CString) TEXT("PFAX_JOB_ENTRYA");
  943. break;
  944. case ePPFAX_JOB_ENTRYA:
  945. /* The parameter type is PFAX_JOB_ENTRYA *. */
  946. csParameterType = (CString) TEXT("PFAX_JOB_ENTRYA *");
  947. break;
  948. case ePFAX_JOB_ENTRYW:
  949. /* The parameter type is PFAX_JOB_ENTRYW. */
  950. csParameterType = (CString) TEXT("PFAX_JOB_ENTRYW");
  951. break;
  952. case ePPFAX_JOB_ENTRYW:
  953. /* The parameter type is PFAX_JOB_ENTRYW *. */
  954. csParameterType = (CString) TEXT("PFAX_JOB_ENTRYW *");
  955. break;
  956. case ePFAX_JOB_PARAMA:
  957. /* The parameter type is PFAX_JOB_PARAMA. */
  958. csParameterType = (CString) TEXT("PFAX_JOB_PARAMA");
  959. break;
  960. case ePFAX_JOB_PARAMW:
  961. /* The parameter type is PFAX_JOB_PARAMW. */
  962. csParameterType = (CString) TEXT("PFAX_JOB_PARAMW");
  963. break;
  964. case ePFAX_PORT_INFOA:
  965. /* The parameter type is PFAX_PORT_INFOA. */
  966. csParameterType = (CString) TEXT("PFAX_PORT_INFOA");
  967. break;
  968. case ePPFAX_PORT_INFOA:
  969. /* The parameter type is PFAX_PORT_INFOA *. */
  970. csParameterType = (CString) TEXT("PFAX_PORT_INFOA *");
  971. break;
  972. case ePFAX_PORT_INFOW:
  973. /* The parameter type is PFAX_PORT_INFOW. */
  974. csParameterType = (CString) TEXT("PFAX_PORT_INFOW");
  975. break;
  976. case ePPFAX_PORT_INFOW:
  977. /* The parameter type is PFAX_PORT_INFOW *. */
  978. csParameterType = (CString) TEXT("PFAX_PORT_INFOW *");
  979. break;
  980. case ePFAX_PRINT_INFOA:
  981. /* The parameter type is PFAX_PRINT_INFOA. */
  982. csParameterType = (CString) TEXT("PFAX_PRINT_INFOA");
  983. break;
  984. case ePFAX_PRINT_INFOW:
  985. /* The parameter type is PFAX_PRINT_INFOW. */
  986. csParameterType = (CString) TEXT("PFAX_PRINT_INFOW");
  987. break;
  988. case ePPFAX_ROUTING_METHODA:
  989. /* The parameter type is PFAX_ROUTING_METHODA *. */
  990. csParameterType = (CString) TEXT("PFAX_ROUTING_METHODA *");
  991. break;
  992. case ePPFAX_ROUTING_METHODW:
  993. /* The parameter type is PFAX_ROUTING_METHODW *. */
  994. csParameterType = (CString) TEXT("PFAX_ROUTING_METHODW *");
  995. break;
  996. default:
  997. csParameterType.Empty();
  998. break;
  999. }
  1000. return ( csParameterType );
  1001. }
  1002. /*
  1003. * GetParameterTypeEnum
  1004. *
  1005. * Purpose:
  1006. * This function returns the eParamType value thet represents the
  1007. * data type of the parameter whose index is xParameterIndex.
  1008. *
  1009. * Arguments:
  1010. * xParameterIndex = the index into the CPtrArray to the pointer
  1011. * to the CFaxApiFunctionParameterInfo object.
  1012. *
  1013. * Returns:
  1014. * The eParamType value that represents the data type of the parameter.
  1015. *
  1016. * Note:
  1017. * GetParameterTypeEnum is overloaded to accept either a integer or
  1018. * a reference to a CString as a parameter.
  1019. *
  1020. */
  1021. eParamType CFaxApiFunctionParameterInfo::GetParameterTypeEnum( int xParameterIndex )
  1022. {
  1023. return ( (eParamType) m_cuiaParameterTypeEnum.GetAt( xParameterIndex ) );
  1024. }
  1025. /*
  1026. * GetParameterTypeEnum
  1027. *
  1028. * Purpose:
  1029. * This function returns the eParamType value that represents the
  1030. * data type specified in rcsParameterType.
  1031. *
  1032. * Arguments:
  1033. * rcsParameterType - a reference to a CString that contains the data
  1034. * type of the parameter.
  1035. *
  1036. * Returns:
  1037. * The eParamType value that represents the data type of the parameter.
  1038. *
  1039. * Note:
  1040. * GetParameterTypeEnum is overloaded to accept either a integer or
  1041. * a reference to a CString as a parameter.
  1042. *
  1043. * As much as I hate to use a "goto" statement in a structured language
  1044. * in this case I feel it is justified in order to avoid executing the
  1045. * comparisons that will fail.
  1046. *
  1047. */
  1048. eParamType CFaxApiFunctionParameterInfo::GetParameterTypeEnum( const CString & rcsParameterType )
  1049. {
  1050. eParamType eReturnValue;
  1051. /* As of 6/11/97, there are 22 types of parameters. */
  1052. /* Note: a "switch" statement cannot be used here because rcsParameterType */
  1053. /* is not an integral type and is an illegal switch expression. */
  1054. if ( rcsParameterType.Compare( TEXT("BOOL") ) == 0 )
  1055. {
  1056. /* Note: "BOOL" is typedefed, in windef.h, as type int. It is not the */
  1057. /* the same as the native data type "bool". */
  1058. eReturnValue = eBOOL;
  1059. goto ExitGetParameterTypeEnum;
  1060. }
  1061. if ( rcsParameterType.Compare( TEXT("DWORD") ) == 0 )
  1062. {
  1063. eReturnValue = eDWORD;
  1064. goto ExitGetParameterTypeEnum;
  1065. }
  1066. if ( rcsParameterType.Compare( TEXT("HANDLE") ) == 0 )
  1067. {
  1068. eReturnValue = eHANDLE;
  1069. goto ExitGetParameterTypeEnum;
  1070. }
  1071. if ( rcsParameterType.Compare( TEXT("HDC") ) == 0 )
  1072. {
  1073. eReturnValue = eHDC;
  1074. goto ExitGetParameterTypeEnum;
  1075. }
  1076. if ( rcsParameterType.Compare( TEXT("HDC *") ) == 0 )
  1077. {
  1078. eReturnValue = ePHDC;
  1079. goto ExitGetParameterTypeEnum;
  1080. }
  1081. if ( rcsParameterType.Compare( TEXT("LPBYTE") ) == 0 )
  1082. {
  1083. eReturnValue = eLPBYTE;
  1084. goto ExitGetParameterTypeEnum;
  1085. }
  1086. if ( rcsParameterType.Compare( TEXT("LPBYTE *") ) == 0 )
  1087. {
  1088. eReturnValue = ePLPBYTE;
  1089. goto ExitGetParameterTypeEnum;
  1090. }
  1091. if ( rcsParameterType.Compare( TEXT("LPDWORD") ) == 0 )
  1092. {
  1093. eReturnValue = eLPDWORD;
  1094. goto ExitGetParameterTypeEnum;
  1095. }
  1096. if ( rcsParameterType.Compare( TEXT("LPHANDLE") ) == 0 )
  1097. {
  1098. eReturnValue = eLPHANDLE;
  1099. goto ExitGetParameterTypeEnum;
  1100. }
  1101. if ( rcsParameterType.Compare( TEXT("LPSTR") ) == 0 )
  1102. {
  1103. eReturnValue = eLPSTR;
  1104. goto ExitGetParameterTypeEnum;
  1105. }
  1106. if ( rcsParameterType.Compare( TEXT("LPVOID") ) == 0 )
  1107. {
  1108. eReturnValue = eLPVOID;
  1109. goto ExitGetParameterTypeEnum;
  1110. }
  1111. if ( rcsParameterType.Compare( TEXT("LPWSTR") ) == 0 )
  1112. {
  1113. eReturnValue = eLPWSTR;
  1114. goto ExitGetParameterTypeEnum;
  1115. }
  1116. if ( rcsParameterType.Compare( TEXT("PFAX_CONFIGURATIONA") ) == 0 )
  1117. {
  1118. eReturnValue = ePFAX_CONFIGURATIONA;
  1119. goto ExitGetParameterTypeEnum;
  1120. }
  1121. if ( rcsParameterType.Compare( TEXT("PFAX_CONFIGURATIONA *") ) == 0 )
  1122. {
  1123. eReturnValue = ePPFAX_CONFIGURATIONA;
  1124. goto ExitGetParameterTypeEnum;
  1125. }
  1126. if ( rcsParameterType.Compare( TEXT("PFAX_CONFIGURATIONW") ) == 0 )
  1127. {
  1128. eReturnValue = ePFAX_CONFIGURATIONW;
  1129. goto ExitGetParameterTypeEnum;
  1130. }
  1131. if ( rcsParameterType.Compare( TEXT("PFAX_CONFIGURATIONW *") ) == 0 )
  1132. {
  1133. eReturnValue = ePPFAX_CONFIGURATIONW;
  1134. goto ExitGetParameterTypeEnum;
  1135. }
  1136. if ( rcsParameterType.Compare( TEXT("PFAX_COVERPAGE_INFOA") ) == 0 )
  1137. {
  1138. eReturnValue = ePFAX_COVERPAGE_INFOA;
  1139. goto ExitGetParameterTypeEnum;
  1140. }
  1141. if ( rcsParameterType.Compare( TEXT("PFAX_COVERPAGE_INFOW") ) == 0 )
  1142. {
  1143. eReturnValue = ePFAX_COVERPAGE_INFOW;
  1144. goto ExitGetParameterTypeEnum;
  1145. }
  1146. if ( rcsParameterType.Compare( TEXT("PFAX_DEVICE_STATUSA *") ) == 0 )
  1147. {
  1148. eReturnValue = ePPFAX_DEVICE_STATUSA;
  1149. goto ExitGetParameterTypeEnum;
  1150. }
  1151. if ( rcsParameterType.Compare( TEXT("PFAX_DEVICE_STATUSW *") ) == 0 )
  1152. {
  1153. eReturnValue = ePPFAX_DEVICE_STATUSW;
  1154. goto ExitGetParameterTypeEnum;
  1155. }
  1156. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_ENTRYA") ) == 0 )
  1157. {
  1158. eReturnValue = ePFAX_JOB_ENTRYA;
  1159. goto ExitGetParameterTypeEnum;
  1160. }
  1161. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_ENTRYA *") ) == 0 )
  1162. {
  1163. eReturnValue = ePPFAX_JOB_ENTRYA;
  1164. goto ExitGetParameterTypeEnum;
  1165. }
  1166. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_ENTRYW") ) == 0 )
  1167. {
  1168. eReturnValue = ePFAX_JOB_ENTRYW;
  1169. goto ExitGetParameterTypeEnum;
  1170. }
  1171. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_ENTRYW *") ) == 0 )
  1172. {
  1173. eReturnValue = ePPFAX_JOB_ENTRYW;
  1174. goto ExitGetParameterTypeEnum;
  1175. }
  1176. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_PARAMA") ) == 0 )
  1177. {
  1178. eReturnValue = ePFAX_JOB_PARAMA;
  1179. goto ExitGetParameterTypeEnum;
  1180. }
  1181. if ( rcsParameterType.Compare( TEXT("PFAX_JOB_PARAMW") ) == 0 )
  1182. {
  1183. eReturnValue = ePFAX_JOB_PARAMW;
  1184. goto ExitGetParameterTypeEnum;
  1185. }
  1186. if ( rcsParameterType.Compare( TEXT("PFAX_LOG_CATEGORY") ) == 0 )
  1187. {
  1188. eReturnValue = ePFAX_LOG_CATEGORY;
  1189. goto ExitGetParameterTypeEnum;
  1190. }
  1191. if ( rcsParameterType.Compare( TEXT("PFAX_LOG_CATEGORY *") ) == 0 )
  1192. {
  1193. eReturnValue = ePPFAX_LOG_CATEGORY;
  1194. goto ExitGetParameterTypeEnum;
  1195. }
  1196. if ( rcsParameterType.Compare( TEXT("PFAX_PORT_INFOA") ) == 0 )
  1197. {
  1198. eReturnValue = ePFAX_PORT_INFOA;
  1199. goto ExitGetParameterTypeEnum;
  1200. }
  1201. if ( rcsParameterType.Compare( TEXT("PFAX_PORT_INFOA *") ) == 0 )
  1202. {
  1203. eReturnValue = ePPFAX_PORT_INFOA;
  1204. goto ExitGetParameterTypeEnum;
  1205. }
  1206. if ( rcsParameterType.Compare( TEXT("PFAX_PORT_INFOW") ) == 0 )
  1207. {
  1208. eReturnValue = ePFAX_PORT_INFOW;
  1209. goto ExitGetParameterTypeEnum;
  1210. }
  1211. if ( rcsParameterType.Compare( TEXT("PFAX_PORT_INFOW *") ) == 0 )
  1212. {
  1213. eReturnValue = ePPFAX_PORT_INFOW;
  1214. goto ExitGetParameterTypeEnum;
  1215. }
  1216. if ( rcsParameterType.Compare( TEXT("PFAX_PRINT_INFOA") ) == 0 )
  1217. {
  1218. eReturnValue = ePFAX_PRINT_INFOA;
  1219. goto ExitGetParameterTypeEnum;
  1220. }
  1221. if ( rcsParameterType.Compare( TEXT("PFAX_PRINT_INFOW") ) == 0 )
  1222. {
  1223. eReturnValue = ePFAX_PRINT_INFOW;
  1224. goto ExitGetParameterTypeEnum;
  1225. }
  1226. if ( rcsParameterType.Compare( TEXT("PFAX_ROUTING_METHODA *") ) == 0 )
  1227. {
  1228. eReturnValue = ePPFAX_ROUTING_METHODA;
  1229. goto ExitGetParameterTypeEnum;
  1230. }
  1231. if ( rcsParameterType.Compare( TEXT("PFAX_ROUTING_METHODW *") ) == 0 )
  1232. {
  1233. eReturnValue = ePPFAX_ROUTING_METHODW;
  1234. goto ExitGetParameterTypeEnum;
  1235. }
  1236. else
  1237. {
  1238. eReturnValue = eUnknownParamType; // the parameter type wasn't
  1239. // in the list above !
  1240. }
  1241. ExitGetParameterTypeEnum:
  1242. return ( eReturnValue );
  1243. }
  1244. /*
  1245. * GetParameterDescription
  1246. *
  1247. * Purpose:
  1248. * This function retrieves the description for a parameter to a
  1249. * Fax API function.
  1250. *
  1251. * Arguments:
  1252. * xParameterIndex = the index into the CPtrArray to the pointer
  1253. * to the CFaxApiFunctionParameterInfo object.
  1254. *
  1255. * Returns:
  1256. * A CString that contains the description of the parameter.
  1257. *
  1258. */
  1259. CString CFaxApiFunctionParameterInfo::GetParameterDescription( int xParameterIndex )
  1260. {
  1261. return ( m_csaParameterDescription.GetAt( xParameterIndex ) );
  1262. }
  1263. /*
  1264. * StoreParameterValue
  1265. *
  1266. * Purpose:
  1267. * This function stores the value contained in a CSting in the storage
  1268. * location for the parameter value indexed by xParameterIndex.
  1269. *
  1270. * Arguments:
  1271. * xParameterIndex - the index to the pointer to the storage for a
  1272. * parameer value.
  1273. * rcsParameterValue - a reference to a CString that contains a
  1274. * representation of the value to be stored.
  1275. *
  1276. * Returns:
  1277. * TRUE - indicates success
  1278. * FALSE - indicates failure
  1279. *
  1280. */
  1281. BOOL CFaxApiFunctionParameterInfo::StoreParameterValue( int xParameterIndex, CString & rcsParameterValue )
  1282. {
  1283. BOOL fReturnValue = (BOOL) TRUE;
  1284. CString csParameterValue;
  1285. /* Get the parameter type. */
  1286. eParamType eParameterType;
  1287. eParameterType = GetParameterTypeEnum( xParameterIndex );
  1288. if ( (eParameterType != eLPSTR) && (eParameterType != eLPWSTR) )
  1289. {
  1290. /* rcsParameterValue may begin with "0x", "0X", "x" or "X". */
  1291. /* The first two will be scanned properly, but the second */
  1292. /* two will not. The following code segment eliminates the */
  1293. /* second two prefixes if they exist. */
  1294. csParameterValue = PreProcessParameterValueString( (const CString &) rcsParameterValue );
  1295. }
  1296. else
  1297. {
  1298. csParameterValue = rcsParameterValue;
  1299. }
  1300. /* Get a pointer to the string representation of the parameter value. */
  1301. LPTSTR ptszParameterValue;
  1302. ptszParameterValue = (LPTSTR) csParameterValue.GetBuffer( MAX_PARAM_VALUE_STRING_LENGTH ); // arbitrary size
  1303. /* Get a pointer to the storage for the parameter. */
  1304. void * pvParameterValue;
  1305. pvParameterValue = GetParameterValuePointer( xParameterIndex );
  1306. /* As of 6/11/97, there are 22 types of parameters. */
  1307. switch ( eParameterType )
  1308. {
  1309. case eBOOL:
  1310. {
  1311. /* The parameter type is BOOL. */
  1312. BOOL fParameterValue = (BOOL) FALSE; // set default value
  1313. if ( csParameterValue.CompareNoCase( TEXT("FALSE") ) == 0 )
  1314. {
  1315. *((BOOL *) pvParameterValue) = (BOOL) FALSE;
  1316. }
  1317. else
  1318. {
  1319. if ( csParameterValue.CompareNoCase( TEXT("TRUE") ) == 0 )
  1320. {
  1321. *((BOOL *) pvParameterValue) = (BOOL) TRUE;
  1322. }
  1323. else
  1324. {
  1325. swscanf( (const wchar_t *) ptszParameterValue,
  1326. (const wchar_t *) TEXT("%x"),
  1327. &fParameterValue );
  1328. *((BOOL *) pvParameterValue) = fParameterValue;
  1329. }
  1330. }
  1331. }
  1332. break;
  1333. case eDWORD:
  1334. {
  1335. /* The parameter type is DWORD. */
  1336. DWORD dwParameterValue = (DWORD) 0L; // set default value
  1337. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &dwParameterValue );
  1338. *((DWORD *) pvParameterValue) = (DWORD) dwParameterValue;
  1339. }
  1340. break;
  1341. case eHANDLE:
  1342. {
  1343. /* The parameter type is HANDLE. */
  1344. HANDLE hParameterValue = (HANDLE) INVALID_HANDLE_VALUE;
  1345. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &hParameterValue );
  1346. *((HANDLE *) pvParameterValue) = hParameterValue;
  1347. }
  1348. break;
  1349. case eHDC:
  1350. {
  1351. /* The parameter type is HDC. */
  1352. HDC hdcParameterValue = (HDC) INVALID_HANDLE_VALUE;
  1353. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &hdcParameterValue );
  1354. *((HDC *) pvParameterValue) = hdcParameterValue;
  1355. }
  1356. break;
  1357. case ePHDC:
  1358. {
  1359. /* The parameter type is HDC *. */
  1360. HDC * phdcParameterValue = (HDC *) NULL;
  1361. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &phdcParameterValue );
  1362. *((HDC * *) pvParameterValue) = phdcParameterValue;
  1363. }
  1364. break;
  1365. case eLPBYTE:
  1366. {
  1367. /* The parameter type is LPBYTE. */
  1368. LPBYTE pbParameterValue = (LPBYTE) NULL;
  1369. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pbParameterValue );
  1370. *((LPBYTE *) pvParameterValue) = pbParameterValue;
  1371. }
  1372. break;
  1373. case ePLPBYTE:
  1374. {
  1375. /* The parameter type is LPBYTE *. */
  1376. LPBYTE * ppbParameterValue = (LPBYTE *) NULL;
  1377. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppbParameterValue );
  1378. *((LPBYTE * *) pvParameterValue) = ppbParameterValue;
  1379. }
  1380. break;
  1381. case eLPDWORD:
  1382. {
  1383. /* The parameter type is LPDWORD. */
  1384. LPDWORD pdwParameterValue = (LPDWORD) NULL;
  1385. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pdwParameterValue );
  1386. *((LPDWORD *) pvParameterValue) = pdwParameterValue;
  1387. }
  1388. break;
  1389. case eLPHANDLE:
  1390. {
  1391. /* The parameter type is LPHANDLE. */
  1392. LPHANDLE phParameterValue = (LPHANDLE) NULL;
  1393. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &phParameterValue );
  1394. *((LPHANDLE *) pvParameterValue) = phParameterValue;
  1395. }
  1396. break;
  1397. case eLPSTR:
  1398. {
  1399. /* The parameter type is LPSTR. */
  1400. /* Convert ptszParameterValue to ANSI !! */
  1401. size_t t_WideStringLength;
  1402. t_WideStringLength = wcslen( ptszParameterValue );
  1403. LPSTR pszAnsiString;
  1404. pszAnsiString = new char[t_WideStringLength+1]; // reserve a character for the NULL
  1405. LPSTR * ppszParameterValue;
  1406. ppszParameterValue = (LPSTR *) pvParameterValue;
  1407. if ( pszAnsiString != (LPSTR) NULL )
  1408. {
  1409. int xNumberOfCharsConverted;
  1410. xNumberOfCharsConverted = wcstombs( pszAnsiString, ptszParameterValue, t_WideStringLength );
  1411. /* Terminate the Ansi string. */
  1412. pszAnsiString[xNumberOfCharsConverted] = (char) '\0';
  1413. strcpy( (char *) ppszParameterValue, (const char *) pszAnsiString );
  1414. delete [] pszAnsiString;
  1415. }
  1416. else
  1417. {
  1418. **ppszParameterValue = (char) '\0';
  1419. }
  1420. }
  1421. break;
  1422. case eLPVOID:
  1423. {
  1424. /* The parameter type is LPVOID. */
  1425. LPVOID pvDataValue = (LPVOID) NULL;
  1426. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pvDataValue );
  1427. *((LPVOID *) pvParameterValue) = pvDataValue;
  1428. }
  1429. break;
  1430. case eLPWSTR:
  1431. {
  1432. /* The parameter type is LPWSTR. */
  1433. LPWSTR * ppwszParameterValue;
  1434. ppwszParameterValue = (LPWSTR *) pvParameterValue;
  1435. wcscpy( (wchar_t *) ppwszParameterValue, (const wchar_t *) ptszParameterValue );
  1436. }
  1437. break;
  1438. case ePFAX_CONFIGURATIONA:
  1439. {
  1440. /* The parameter type is PFAX_CONFIGURATIONA. */
  1441. PFAX_CONFIGURATIONA pfcaParameterValue = (PFAX_CONFIGURATIONA) NULL;
  1442. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcaParameterValue );
  1443. *((PFAX_CONFIGURATIONA *) pvParameterValue) = pfcaParameterValue;
  1444. }
  1445. break;
  1446. case ePPFAX_CONFIGURATIONA:
  1447. {
  1448. /* The parameter type is PFAX_CONFIGURATIONA *. */
  1449. PFAX_CONFIGURATIONA * ppfcaParameterValue = (PFAX_CONFIGURATIONA *) NULL;
  1450. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcaParameterValue );
  1451. *((PFAX_CONFIGURATIONA * *) pvParameterValue) = ppfcaParameterValue;
  1452. }
  1453. break;
  1454. case ePFAX_CONFIGURATIONW:
  1455. {
  1456. /* The parameter type is PFAX_CONFIGURATIONW. */
  1457. PFAX_CONFIGURATIONW pfcwParameterValue = (PFAX_CONFIGURATIONW) NULL;
  1458. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1459. *((PFAX_CONFIGURATIONW *) pvParameterValue) = pfcwParameterValue;
  1460. }
  1461. break;
  1462. case ePPFAX_CONFIGURATIONW:
  1463. {
  1464. /* The parameter type is PFAX_CONFIGURATIONW *. */
  1465. PFAX_CONFIGURATIONW * ppfcwParameterValue = (PFAX_CONFIGURATIONW *) NULL;
  1466. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1467. *((PFAX_CONFIGURATIONW * *) pvParameterValue) = ppfcwParameterValue;
  1468. }
  1469. break;
  1470. case ePFAX_COVERPAGE_INFOA:
  1471. {
  1472. /* The parameter type is PFAX_COVERPAGE_INFOA. */
  1473. PFAX_COVERPAGE_INFOA pfciaParameterValue = (PFAX_COVERPAGE_INFOA) NULL;
  1474. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfciaParameterValue );
  1475. *((PFAX_COVERPAGE_INFOA *) pvParameterValue) = pfciaParameterValue;
  1476. }
  1477. break;
  1478. case ePFAX_COVERPAGE_INFOW:
  1479. {
  1480. /* The parameter type is PFAX_COVERPAGE_INFOW. */
  1481. PFAX_COVERPAGE_INFOW pfciwParameterValue = (PFAX_COVERPAGE_INFOW) NULL;
  1482. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfciwParameterValue );
  1483. *((PFAX_COVERPAGE_INFOW *) pvParameterValue) = pfciwParameterValue;
  1484. }
  1485. break;
  1486. case ePPFAX_DEVICE_STATUSA:
  1487. {
  1488. /* The parameter type is PFAX_DEVICE_STATUSA *. */
  1489. PFAX_DEVICE_STATUSA * ppfcwParameterValue = (PFAX_DEVICE_STATUSA *) NULL;
  1490. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1491. *((PFAX_DEVICE_STATUSA * *) pvParameterValue) = ppfcwParameterValue;
  1492. }
  1493. break;
  1494. case ePPFAX_DEVICE_STATUSW:
  1495. {
  1496. /* The parameter type is PFAX_DEVICE_STATUSW *. */
  1497. PFAX_DEVICE_STATUSW * ppfcwParameterValue = (PFAX_DEVICE_STATUSW *) NULL;
  1498. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1499. *((PFAX_DEVICE_STATUSW * *) pvParameterValue) = ppfcwParameterValue;
  1500. }
  1501. break;
  1502. case ePFAX_JOB_ENTRYA:
  1503. {
  1504. /* The parameter type is PFAX_JOB_ENTRYA. */
  1505. PFAX_JOB_ENTRYA pfcwParameterValue = (PFAX_JOB_ENTRYA) NULL;
  1506. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1507. *((PFAX_JOB_ENTRYA *) pvParameterValue) = pfcwParameterValue;
  1508. }
  1509. break;
  1510. case ePPFAX_JOB_ENTRYA:
  1511. {
  1512. /* The parameter type is PFAX_JOB_ENTRYA *. */
  1513. PFAX_JOB_ENTRYA * ppfcwParameterValue = (PFAX_JOB_ENTRYA *) NULL;
  1514. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1515. *((PFAX_JOB_ENTRYA * *) pvParameterValue) = ppfcwParameterValue;
  1516. }
  1517. break;
  1518. case ePFAX_JOB_ENTRYW:
  1519. {
  1520. /* The parameter type is PFAX_JOB_ENTRYW. */
  1521. PFAX_JOB_ENTRYW pfcwParameterValue = (PFAX_JOB_ENTRYW) NULL;
  1522. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1523. *((PFAX_JOB_ENTRYW *) pvParameterValue) = pfcwParameterValue;
  1524. }
  1525. break;
  1526. case ePPFAX_JOB_ENTRYW:
  1527. {
  1528. /* The parameter type is PFAX_JOB_ENTRYW *. */
  1529. PFAX_JOB_ENTRYW * ppfcwParameterValue = (PFAX_JOB_ENTRYW *) NULL;
  1530. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1531. *((PFAX_JOB_ENTRYW * *) pvParameterValue) = ppfcwParameterValue;
  1532. }
  1533. break;
  1534. case ePFAX_JOB_PARAMA:
  1535. {
  1536. /* The parameter type is PFAX_JOB_PARAMA. */
  1537. PFAX_JOB_PARAMA pfjpaParameterValue = (PFAX_JOB_PARAMA) NULL;
  1538. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfjpaParameterValue );
  1539. *((PFAX_JOB_PARAMA *) pvParameterValue) = pfjpaParameterValue;
  1540. }
  1541. break;
  1542. case ePFAX_JOB_PARAMW:
  1543. {
  1544. /* The parameter type is PFAX_JOB_PARAMW. */
  1545. PFAX_JOB_PARAMW pfjpwParameterValue = (PFAX_JOB_PARAMW) NULL;
  1546. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfjpwParameterValue );
  1547. *((PFAX_JOB_PARAMW *) pvParameterValue) = pfjpwParameterValue;
  1548. }
  1549. break;
  1550. case ePFAX_LOG_CATEGORY:
  1551. {
  1552. /* The parameter type is PFAX_LOG_CATEGORY. */
  1553. PFAX_LOG_CATEGORY pfcwParameterValue = (PFAX_LOG_CATEGORY) NULL;
  1554. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1555. *((PFAX_LOG_CATEGORY *) pvParameterValue) = pfcwParameterValue;
  1556. }
  1557. break;
  1558. case ePPFAX_LOG_CATEGORY:
  1559. {
  1560. /* The parameter type is PFAX_LOG_CATEGORY *. */
  1561. PFAX_LOG_CATEGORY * ppfcwParameterValue = (PFAX_LOG_CATEGORY *) NULL;
  1562. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1563. *((PFAX_LOG_CATEGORY * *) pvParameterValue) = ppfcwParameterValue;
  1564. }
  1565. break;
  1566. case ePFAX_PORT_INFOA:
  1567. {
  1568. /* The parameter type is PFAX_PORT_INFOA. */
  1569. PFAX_PORT_INFOA pfcwParameterValue = (PFAX_PORT_INFOA) NULL;
  1570. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1571. *((PFAX_PORT_INFOA *) pvParameterValue) = pfcwParameterValue;
  1572. }
  1573. break;
  1574. case ePPFAX_PORT_INFOA:
  1575. {
  1576. /* The parameter type is PFAX_PORT_INFOA *. */
  1577. PFAX_PORT_INFOA * ppfcwParameterValue = (PFAX_PORT_INFOA *) NULL;
  1578. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1579. *((PFAX_PORT_INFOA * *) pvParameterValue) = ppfcwParameterValue;
  1580. }
  1581. break;
  1582. case ePFAX_PORT_INFOW:
  1583. {
  1584. /* The parameter type is PFAX_PORT_INFOW. */
  1585. PFAX_PORT_INFOW pfcwParameterValue = (PFAX_PORT_INFOW) NULL;
  1586. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfcwParameterValue );
  1587. *((PFAX_PORT_INFOW *) pvParameterValue) = pfcwParameterValue;
  1588. }
  1589. break;
  1590. case ePPFAX_PORT_INFOW:
  1591. {
  1592. /* The parameter type is PFAX_PORT_INFOW *. */
  1593. PFAX_PORT_INFOW * ppfcwParameterValue = (PFAX_PORT_INFOW *) NULL;
  1594. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1595. *((PFAX_PORT_INFOW * *) pvParameterValue) = ppfcwParameterValue;
  1596. }
  1597. break;
  1598. case ePFAX_PRINT_INFOA:
  1599. {
  1600. /* The parameter type is PFAX_PRINT_INFOA. */
  1601. PFAX_PRINT_INFOA pfpiaParameterValue = (PFAX_PRINT_INFOA) NULL;
  1602. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfpiaParameterValue );
  1603. *((PFAX_PRINT_INFOA *) pvParameterValue) = pfpiaParameterValue;
  1604. }
  1605. break;
  1606. case ePFAX_PRINT_INFOW:
  1607. {
  1608. /* The parameter type is PFAX_PRINT_INFOW. */
  1609. PFAX_PRINT_INFOW pfpiwParameterValue = (PFAX_PRINT_INFOW) NULL;
  1610. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &pfpiwParameterValue );
  1611. *((PFAX_PRINT_INFOW *) pvParameterValue) = pfpiwParameterValue;
  1612. }
  1613. break;
  1614. case ePPFAX_ROUTING_METHODA:
  1615. {
  1616. /* The parameter type is PFAX_ROUTING_METHODA *. */
  1617. PFAX_ROUTING_METHODA * ppfcwParameterValue = (PFAX_ROUTING_METHODA *) NULL;
  1618. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1619. *((PFAX_ROUTING_METHODA * *) pvParameterValue) = ppfcwParameterValue;
  1620. }
  1621. break;
  1622. case ePPFAX_ROUTING_METHODW:
  1623. {
  1624. /* The parameter type is PFAX_ROUTING_METHODW *. */
  1625. PFAX_ROUTING_METHODW * ppfcwParameterValue = (PFAX_ROUTING_METHODW *) NULL;
  1626. swscanf( (const wchar_t *) ptszParameterValue, (const wchar_t *) TEXT("%x"), &ppfcwParameterValue );
  1627. *((PFAX_ROUTING_METHODW * *) pvParameterValue) = ppfcwParameterValue;
  1628. }
  1629. break;
  1630. default:
  1631. {
  1632. /* The parameter type was not recognized by the "if" statements above. */
  1633. CString csMessage;
  1634. csMessage.Format( TEXT("Unrecognized type in StoreParameterValue.") );
  1635. AfxMessageBox( csMessage );
  1636. fReturnValue = (BOOL) FALSE;
  1637. }
  1638. break;
  1639. }
  1640. csParameterValue.ReleaseBuffer();
  1641. return ( fReturnValue );
  1642. }
  1643. /*
  1644. * PreProcessParameterValueString
  1645. *
  1646. * Purpose:
  1647. * This function prepares a CString object to be scanned as a
  1648. * hexadecimal number by removing the characters "x" ot "X" if
  1649. * they appear as a prefix.
  1650. *
  1651. * Arguments:
  1652. * rcsParameterValue - a reference to a CString that contains the
  1653. * parameter value.
  1654. *
  1655. * Returns:
  1656. * a CString that has been formatted to be properly scanned as a
  1657. * hexadecimal value.
  1658. *
  1659. */
  1660. CString CFaxApiFunctionParameterInfo::PreProcessParameterValueString( const CString & rcsParameterValue )
  1661. {
  1662. CString csParameterValue;
  1663. if ( rcsParameterValue.FindOneOf( TEXT("xX") ) == 0 )
  1664. {
  1665. int xStringLength;
  1666. xStringLength = rcsParameterValue.GetLength();
  1667. /* Remove the "x" ot "X" prefix. */
  1668. csParameterValue = rcsParameterValue.Right( xStringLength - 1 );
  1669. }
  1670. else
  1671. {
  1672. csParameterValue = rcsParameterValue;
  1673. }
  1674. return ( csParameterValue );
  1675. }