Changeset 55159fd in nscp


Ignore:
Timestamp:
02/16/05 23:30:52 (8 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
50744c5
Parents:
402f042
Message:

removed some debugging code, and added "getBasePath" to allow modules to find the "root"

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • StdAfx.h

    ra0528c4 r55159fd  
    2525#include <singleton.h> 
    2626#include <charEx.h> 
     27#include <memory> 
    2728 
    2829#endif // !defined(AFX_STDAFX_H__6B96F953_C431_11D3_BCD2_00A0D21A1A22__INCLUDED_) 
  • include/NSCHelper.cpp

    ra0528c4 r55159fd  
    5959 
    6060namespace NSCModuleHelper { 
     61  lpNSAPIGetBasePath fNSAPIGetBasePath = NULL; 
    6162  lpNSAPIGetApplicationName fNSAPIGetApplicationName = NULL; 
    6263  lpNSAPIGetApplicationVersionStr fNSAPIGetApplicationVersionStr = NULL; 
     
    141142} 
    142143/** 
    143  * Retrieve the application name (in human readable format) from the core. 
    144  * @return A string representing the application name. 
    145  */ 
     144* Retrieve the application name (in human readable format) from the core. 
     145* @return A string representing the application name. 
     146*/ 
    146147std::string NSCModuleHelper::getApplicationName() { 
    147148  if (!fNSAPIGetApplicationName) 
     
    150151  if (fNSAPIGetApplicationName(buffer, BUFF_LEN) != NSCAPI::success) 
    151152    throw "Application name could not be retrieved"; 
     153  std::string ret = buffer; 
     154  delete [] buffer; 
     155  return ret; 
     156} 
     157/** 
     158 * Retrieve the directory root of the application from the core. 
     159 * @return A string representing the base path. 
     160 */ 
     161std::string NSCModuleHelper::getBasePath() { 
     162  if (!fNSAPIGetBasePath) 
     163    return "NSCore has not been initiated..."; 
     164  char *buffer = new char[BUFF_LEN+1]; 
     165  if (fNSAPIGetBasePath(buffer, BUFF_LEN) != NSCAPI::success) 
     166    throw "Base path could not be retrieved"; 
    152167  std::string ret = buffer; 
    153168  delete [] buffer; 
     
    216231  NSCModuleHelper::fNSAPIStopServer = (NSCModuleHelper::lpNSAPIStopServer)f("NSAPIStopServer"); 
    217232  NSCModuleHelper::fNSAPIInject = (NSCModuleHelper::lpNSAPIInject)f("NSAPIInject"); 
     233  NSCModuleHelper::fNSAPIGetBasePath = (NSCModuleHelper::lpNSAPIGetBasePath)f("NSAPIGetBasePath"); 
    218234  return NSCAPI::success; 
    219235} 
    220236/** 
    221  * Wrap the GetModuleName function call 
    222  * @param buf Buffer to store the module name 
    223  * @param bufLen Length of buffer 
    224  * @param str String to store inside the buffer 
    225  * @return buffer copy status 
    226  */ 
     237* Wrap the GetModuleName function call 
     238* @param buf Buffer to store the module name 
     239* @param bufLen Length of buffer 
     240* @param str String to store inside the buffer 
     241* @return buffer copy status 
     242*/ 
    227243int NSCModuleWrapper::wrapGetModuleName(char* buf, unsigned int bufLen, std::string str) { 
    228244  return NSCHelper::wrapReturnString(buf, bufLen, str); 
  • include/NSCHelper.h

    ra0528c4 r55159fd  
    1515{ 
    1616  // Types for the Callbacks into the main program 
     17  typedef int (*lpNSAPIGetBasePath)(char*,unsigned int); 
    1718  typedef int (*lpNSAPIGetApplicationName)(char*,unsigned int); 
    1819  typedef int (*lpNSAPIGetApplicationVersionStr)(char*,unsigned int); 
     
    3233  std::string InjectCommand(std::string command); 
    3334  void StopService(void); 
     35  std::string getBasePath(); 
    3436}; 
    3537 
  • include/thread.h

    ra0528c4 r55159fd  
    164164      throw "Could not terminate thread, has not been started yet..."; 
    165165    pObject_->exitThread(); 
    166     std::cout << "Waiting for socket to close..." << std::endl; 
    167166    DWORD dwWaitResult = endMutext.wait(5000L); 
    168167    switch (dwWaitResult) { 
Note: See TracChangeset for help on using the changeset viewer.