home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libpref / src / win / winfunc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.0 KB  |  73 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include "mochaapi.h"
  20. #include "mochalib.h"
  21. #include "xp_core.h"
  22. #include "xp_mcom.h"
  23. #include "prefapi.h"
  24.  
  25. extern MochaContext *        m_mochaContext;
  26. extern MochaObject *        m_mochaPrefObject;
  27.  
  28. int pref_InitInitialObjects() {
  29.     MochaBoolean ok;
  30.     MochaDatum result;
  31.     HRSRC hFound;
  32.     HGLOBAL hRes;
  33.     char * lpBuff = NULL;
  34.     XP_File fp;
  35.     XP_StatStruct stats;
  36.     long fileLength;
  37.  
  38.  
  39. #ifdef FROM_RES
  40.     hFound = FindResource(m_hInstance, "init_prefs", RT_RCDATA);
  41.     hRes = LoadResource(m_hInstance, hFound);
  42.     lpBuff = (char *)LockResource(hRes);
  43.     ok = MOCHA_EvaluateBuffer(m_mochaContext,m_mochaPrefObject,
  44.                   lpBuff, strlen(lpBuff), NULL, 0,
  45.                   &result);
  46. #else
  47.     _stat("c:\\dog\\initprefs", &stats);
  48.  
  49.     fileLength = stats.st_size;
  50.     fp = fopen("c:\\dog\\initprefs", "r");
  51.  
  52.     if (fp) {
  53.         char* readBuf = (char *) malloc(fileLength * sizeof(char));
  54.         if (readBuf) {
  55.             fileLength = XP_FileRead(readBuf, fileLength, fp);
  56.             
  57.             ok = MOCHA_EvaluateBuffer(m_mochaContext,m_mochaPrefObject,
  58.                   readBuf, fileLength, NULL, 0, &result);
  59.             free(readBuf);
  60.             XP_FileClose(fp);
  61.         }
  62.     }
  63. #endif
  64.     return TRUE;
  65. }
  66.  
  67. char *EncodeBase64Buffer(char *subject, long size) {
  68.     return NULL;
  69. }
  70. char *DecodeBase64Buffer(char *subject) {
  71.     return NULL;
  72. }
  73.