ReactOS 0.4.15-dev-7659-ga55345b
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 IDS_ERROR
Definition: resource.h:18
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
Definition: main.c:1174
#define IDS_GRPFILE_READ_ERROR_s
Definition: resource.h:62
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1616
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define MAX_PATHNAME_LEN
Definition: progman.h:54
int32_t INT
Definition: typedefs.h:58
#define OF_EXIST
Definition: winbase.h:127
#define HFILE_ERROR
Definition: winbase.h:111
#define MB_YESNO
Definition: winuser.h:816
char CHAR
Definition: xmlstorage.h:175

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);
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 */
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",
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 msg(x)
Definition: auth_time.c:54
#define IDS_FILE_WRITE_ERROR_s
Definition: resource.h:61
#define IDS_SAVE_GROUP_AS_s
Definition: resource.h:67
#define IDS_INFO
Definition: resource.h:53
#define IDS_FILE_NOT_OVERWRITTEN_s
Definition: resource.h:66
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
GLboolean GLuint group
Definition: glext.h:11120
int WINAPI _lclose(HFILE hFile)
Definition: lfile.c:138
HFILE WINAPI _lcreat(LPCSTR lpPathName, int iAttribute)
Definition: lfile.c:116
LPCWSTR szPath
Definition: env.c:37
Definition: fci.c:127
int ret
int HFILE
Definition: windef.h:298
#define IDCANCEL
Definition: winuser.h:830
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define IDOK
Definition: winuser.h:829
#define MB_OKCANCEL
Definition: winuser.h:803
#define MB_OK
Definition: winuser.h:789
#define MB_ICONINFORMATION
Definition: winuser.h:801
#define MB_DEFBUTTON2
Definition: winuser.h:798

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