25#define MALLOCHUNK 1000
27#define GET_USHORT(buffer, i)\
28 (((BYTE)((buffer)[(i)]) + 0x100 * (BYTE)((buffer)[(i)+1])))
29#define GET_SHORT(buffer, i)\
30 (((BYTE)((buffer)[(i)]) + 0x100 * (signed char)((buffer)[(i)+1])))
31#define PUT_SHORT(buffer, i, s)\
32 (((buffer)[(i)] = (s) & 0xff, (buffer)[(i)+1] = ((s) >> 8) & 0xff))
49static VOID GRPFILE_ModifyFileName(
LPSTR lpszNewName,
LPCSTR lpszOrigName,
53 lpszNewName[
nSize-1] =
'\0';
56 lpszNewName[
strlen(lpszNewName) - 1] =
'\0';
79 bFileNameModified =
TRUE;
83 if (!GRPFILE_ReadFileToBuffer(lpszPath, &hBuffer, &
size))
91 lpszPath, bFileNameModified);
115 HLOCAL hBuffer, hNewBuffer;
123 if (!hBuffer)
return FALSE;
137 hBuffer = hNewBuffer;
165 BOOL bModifiedFileName)
172 INT number_of_programs;
173 BOOL bOverwriteFileOk;
178 bOverwriteFileOk =
FALSE;
181 bOverwriteFileOk =
TRUE;
187 if (extension ==
buffer +
size) extension = 0;
188 else if (extension + 6 >
buffer +
size)
return(0);
212 bModifiedFileName, bOverwriteFileOk,
214 if (!hGroup)
return(0);
217 if (2 * number_of_programs + 34 >
size)
return(0);
218 for (
i=0, seqnum=0;
i < number_of_programs;
i++, seqnum++)
221 if (program_ptr + 24 >
buffer +
size)
return(0);
223 if (!GRPFILE_ScanProgram(
buffer,
size, program_ptr, seqnum,
224 extension, hGroup, lpszGrpFile))
250 LPCSTR lpszName, lpszCmdLine, lpszIconFile, lpszWorkDir;
251 LPCSTR iconinfo_ptr, iconANDbits_ptr, iconXORbits_ptr;
252 INT x,
y, nIconIndex, iconANDsize, iconXORsize;
253 INT nHotKey, nCmdShow;
269 iconANDsize =
GET_USHORT(program_ptr, 10) / 8;
290 if (iconANDbits_ptr + iconANDsize >
buffer +
size ||
291 iconXORbits_ptr + iconXORsize >
buffer +
size)
return(0);
322 if (
ptr[6] !=
'P' ||
ptr[7] !=
'M' ||
323 ptr[8] !=
'C' ||
ptr[9] !=
'C')
return(0);
326 lpszWorkDir =
ptr + 6;
347 lpszCmdLine, lpszIconFile,
348 nIconIndex, lpszWorkDir,
369 group->bFileNameModified);
374 if (!
group->bOverwriteFileOk &&
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);
439 *sizeAnd =
bmp.bmHeight * ((
bmp.bmWidth + 15) / 16 * 2);
441 *sizeXor =
bmp.bmHeight *
bmp.bmWidthBytes;
457BOOL GRPFILE_checksum_half_word;
458BYTE GRPFILE_checksum_last_byte;
464static void GRPFILE_InitChecksum(
void)
466 GRPFILE_checksum = 0;
467 GRPFILE_checksum_half_word = 0;
475static UINT16 GRPFILE_GetChecksum(
void)
477 return GRPFILE_checksum;
500 if (GRPFILE_checksum_half_word) {
501 GRPFILE_checksum -= GRPFILE_checksum_last_byte;
504 if (GRPFILE_checksum_half_word) {
505 GRPFILE_checksum -=
str[
i] << 8;
507 GRPFILE_checksum -=
str[
i];
509 GRPFILE_checksum_half_word ^= 1;
512 if (GRPFILE_checksum_half_word) {
513 GRPFILE_checksum_last_byte =
str[
size-1];
514 GRPFILE_checksum += GRPFILE_checksum_last_byte;
531 INT CurrProg, CurrIcon, nCmdShow,
ptr, seqnum;
533 UINT sizeAnd, sizeXor;
540 GRPFILE_InitChecksum();
546 need_extension =
FALSE;
547 hProgram =
group->hPrograms;
557 if (lpszWorkDir[0] ||
program->nHotKey ||
562 Title = 34 + NumProg * 2;
579 PUT_SHORT(
buffer, 8, nCmdShow);
587 PUT_SHORT(
buffer, 24, 0x0020);
588 PUT_SHORT(
buffer, 26, 0x0020);
589 PUT_SHORT(
buffer, 28, 0x0108);
590 PUT_SHORT(
buffer, 30, 0x0000);
591 PUT_SHORT(
buffer, 32, NumProg);
598 hProgram =
group->hPrograms;
603 PUT_SHORT(
buffer, 0, CurrProg);
607 GRPFILE_CalculateSizes(
program, &CurrProg, &CurrIcon, &sizeAnd, &sizeXor);
618 hProgram =
group->hPrograms;
625 INT next_prog = CurrProg;
626 INT next_icon = CurrIcon;
628 GRPFILE_CalculateSizes(
program, &next_prog, &next_icon, &sizeAnd, &sizeXor);
632 PUT_SHORT(
buffer, 6, 0x048c);
633 PUT_SHORT(
buffer, 8, sizeXor);
634 PUT_SHORT(
buffer, 10, sizeAnd * 8);
635 PUT_SHORT(
buffer, 12, CurrIcon);
636 PUT_SHORT(
buffer, 14, CurrIcon + 12 + sizeAnd);
637 PUT_SHORT(
buffer, 16, CurrIcon + 12);
651 CurrProg = next_prog;
652 CurrIcon = next_icon;
658 hProgram =
group->hPrograms;
664 INT sizeXor = iconinfo->nHeight * iconinfo->nWidthBytes;
665 INT sizeAnd = iconinfo->nHeight * ((iconinfo->nWidth + 15) / 16 * 2);
668 PUT_SHORT(
buffer, 0, iconinfo->ptHotSpot.x);
669 PUT_SHORT(
buffer, 2, iconinfo->ptHotSpot.y);
670 PUT_SHORT(
buffer, 4, iconinfo->nWidth);
671 PUT_SHORT(
buffer, 6, iconinfo->nHeight);
672 PUT_SHORT(
buffer, 8, iconinfo->nWidthBytes);
673 buffer[10] = iconinfo->bPlanes;
674 buffer[11] = iconinfo->bBitsPerPixel;
687 PUT_SHORT(
buffer, 0, 0x8000);
688 PUT_SHORT(
buffer, 2, 0xffff);
689 PUT_SHORT(
buffer, 4, 0x000a);
696 hProgram =
group->hPrograms;
705 PUT_SHORT(
buffer, 0, 0x8101);
706 PUT_SHORT(
buffer, 2, seqnum);
716 PUT_SHORT(
buffer, 0, 0x8102);
717 PUT_SHORT(
buffer, 2, seqnum);
726 PUT_SHORT(
buffer, 0, 0x8103);
727 PUT_SHORT(
buffer, 2, seqnum);
738 PUT_SHORT(
buffer, 0, 0xffff);
739 PUT_SHORT(
buffer, 2, 0xffff);
740 PUT_SHORT(
buffer, 4, 0x0000);
ACPI_SIZE strlen(const char *String)
VOID GROUP_ShowGroupWindow(PROGGROUP *hGroup)
PROGGROUP * GROUP_AddGroup(GROUPFORMAT format, BOOL bIsCommonGroup, LPCWSTR lpszName, LPCWSTR lpszGrpFile, INT left, INT top, INT right, INT bottom, INT xMin, INT yMin, INT nCmdShow, WORD cxIcon, WORD cyIcon, BOOL bOverwriteFileOk, BOOL bSuppressShowWindow)
VOID GROUP_DeleteGroup(PROGGROUP *hGroup)
INT MAIN_MessageBoxIDS_s(UINT ids_text, LPCWSTR str, UINT ids_title, WORD type)
#define IDS_FILE_WRITE_ERROR_s
#define IDS_SAVE_GROUP_AS_s
#define IDS_FILE_NOT_OVERWRITTEN_s
#define IDS_GRPFILE_READ_ERROR_s
#define IDS_UNKNOWN_FEATURE_s
CLIPBOARD_GLOBALS Globals
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
static const WCHAR Title[]
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
static const WCHAR CmdLine[]
_Inout_opt_ PUNICODE_STRING Extension
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
DWORD GRPFILE_ReadGroupFile(LPCWSTR lpszPath, BOOL bIsCommonGroup)
BOOL GRPFILE_WriteGroupFile(PROGGROUP *hGroup)
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
LPVOID NTAPI LocalLock(HLOCAL hMem)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
static unsigned short GET_USHORT(const BYTE *buffer, unsigned i)
static short GET_SHORT(const BYTE *buffer, unsigned i)
int WINAPI _lclose(HFILE hFile)
LONG WINAPI _llseek(HFILE hFile, LONG lOffset, int iOrigin)
HFILE WINAPI _lopen(LPCSTR lpPathName, int iReadWrite)
HFILE WINAPI _lcreat(LPCSTR lpPathName, int iAttribute)
static unsigned int number
PROGRAM * PROGRAM_AddProgram(PROGGROUP *hGroup, HICON hIcon, LPCWSTR lpszName, INT x, INT y, LPCWSTR lpszCmdLine, LPCWSTR lpszIconFile, INT nIconIndex, LPCWSTR lpszWorkDir, INT nHotKey, INT nCmdShow, BOOL bNewVDM)
UINT WINAPI _lwrite(_In_ HFILE hFile, _In_reads_bytes_(uBytes) LPCCH lpBuffer, _In_ UINT uBytes)
*nSize LPSTR _Inout_ LPDWORD nSize
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE, _In_ int, _In_ int, _In_ BYTE, _In_ BYTE, _In_ const BYTE *, _In_ const BYTE *)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
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,...)
BOOL WINAPI IsIconic(_In_ HWND)
BOOL WINAPI IsZoomed(_In_ HWND)
#define MB_ICONINFORMATION