ReactOS  0.4.15-dev-313-g8fde48b
grpfile.c File Reference
#include "progman.h"
Include dependency graph for grpfile.c:

Go to the source code of this file.

Functions

DWORD GRPFILE_ReadGroupFile (LPCWSTR lpszPath, BOOL bIsCommonGroup)
 
BOOL GRPFILE_WriteGroupFile (PROGGROUP *hGroup)
 

Function Documentation

◆ GRPFILE_ReadGroupFile()

DWORD GRPFILE_ReadGroupFile ( LPCWSTR  lpszPath,
BOOL  bIsCommonGroup 
)

Definition at line 65 of file grpfile.c.

66 {
67 #if 0
68  CHAR szPath_gr[MAX_PATHNAME_LEN];
69  BOOL bFileNameModified = FALSE;
71  HLOCAL hBuffer, hGroup;
72  INT size;
73 
74  /* if `.gr' file exists use that */
75  GRPFILE_ModifyFileName(szPath_gr, lpszPath, MAX_PATHNAME_LEN, TRUE);
76  if (OpenFile(szPath_gr, &dummy, OF_EXIST) != HFILE_ERROR)
77  {
78  lpszPath = szPath_gr;
79  bFileNameModified = TRUE;
80  }
81 
82  /* Read the whole file into a buffer */
83  if (!GRPFILE_ReadFileToBuffer(lpszPath, &hBuffer, &size))
84  {
86  return(0);
87  }
88 
89  /* Interpret buffer */
90  hGroup = GRPFILE_ScanGroup(LocalLock(hBuffer), size,
91  lpszPath, bFileNameModified);
92  if (!hGroup)
94 
95  LocalFree(hBuffer);
96 
97  return(hGroup);
98 
99 #else
100  return ERROR_SUCCESS;
101 #endif
102 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
#define IDS_GRPFILE_READ_ERROR_s
Definition: resource.h:62
int32_t INT
Definition: typedefs.h:57
#define HFILE_ERROR
Definition: winbase.h:111
#define MB_YESNO
Definition: winuser.h:811
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAX_PATHNAME_LEN
Definition: progman.h:54
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
GLsizeiptr size
Definition: glext.h:5919
#define OF_EXIST
Definition: winbase.h:127
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
Definition: main.c:1174
unsigned char dummy
Definition: maze.c:118
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1599
#define IDS_ERROR
Definition: resource.h:18

Referenced by GROUP_NewGroup().

◆ GRPFILE_WriteGroupFile()

BOOL GRPFILE_WriteGroupFile ( PROGGROUP hGroup)

Definition at line 358 of file grpfile.c.

359 {
360 #if 0
362  PROGGROUP *group = LocalLock(hGroup);
363  OFSTRUCT dummy;
364  HFILE file;
365  BOOL ret;
366 
367  GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
369  group->bFileNameModified);
370 
371  /* Try not to overwrite original files */
372 
373  /* group->bOverwriteFileOk == TRUE only if a file has the modified format */
374  if (!group->bOverwriteFileOk &&
376  {
377  /* Original file exists, try `.gr' extension */
378  GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
381  {
382  /* File exists. Do not overwrite */
384  IDS_INFO, MB_OK);
385  return FALSE;
386  }
387  /* Inform about the modified file name */
388  if (IDCANCEL ==
391  return FALSE;
392  }
393 
394  {
395  /* Warn about the (possible) incompatibility */
396  CHAR msg[MAX_PATHNAME_LEN + 200];
397  wsprintfA(msg,
398  "Group files written by this DRAFT Program Manager "
399  "possibly cannot be read by the Microsoft Program Manager!!\n"
400  "Are you sure to write %s?", szPath);
401  if (IDOK != MessageBoxA(Globals.hMainWnd, msg, "WARNING",
402  MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
403  }
404 
405  /* Open file */
406  file = _lcreat(szPath, 0);
407  if (file != HFILE_ERROR)
408  {
409  ret = GRPFILE_DoWriteGroupFile(file, group);
410  _lclose(file);
411  }
412  else ret = FALSE;
413 
414  if (!ret)
416 
417  return(ret);
418 
419 #else
420  return TRUE;
421 #endif
422 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
HFILE WINAPI _lcreat(LPCSTR lpPathName, int iAttribute)
Definition: lfile.c:116
char CHAR
Definition: xmlstorage.h:175
#define IDS_SAVE_GROUP_AS_s
Definition: resource.h:67
#define IDS_FILE_WRITE_ERROR_s
Definition: resource.h:61
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define HFILE_ERROR
Definition: winbase.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MB_OKCANCEL
Definition: winuser.h:798
#define MAX_PATHNAME_LEN
Definition: progman.h:54
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
GLboolean GLuint group
Definition: glext.h:11120
const char file[]
Definition: icontest.c:11
#define IDS_FILE_NOT_OVERWRITTEN_s
Definition: resource.h:66
#define MB_ICONINFORMATION
Definition: winuser.h:796
int ret
#define OF_EXIST
Definition: winbase.h:127
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
Definition: main.c:1174
LPCWSTR szPath
Definition: env.c:35
unsigned char dummy
Definition: maze.c:118
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1599
#define MB_OK
Definition: winuser.h:784
#define msg(x)
Definition: auth_time.c:54
#define MB_DEFBUTTON2
Definition: winuser.h:793
#define IDS_ERROR
Definition: resource.h:18
#define IDS_INFO
Definition: resource.h:53
#define IDCANCEL
Definition: winuser.h:825
int HFILE
Definition: windef.h:298
Definition: fci.c:126

Referenced by GROUP_ModifyGroup(), GROUP_NewGroup(), PROGRAM_CopyMoveProgram(), PROGRAM_DeleteProgram(), PROGRAM_ModifyProgram(), and PROGRAM_NewProgram().