Last active
December 18, 2019 22:42
-
-
Save bryc/baa6e06708408d13566b to your computer and use it in GitHub Desktop.
Reading NonClientMetrics and IconMetrics data in C. Access inaccessible variables for modifying the metrics of desktop icons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Just a tool for converting space-delimited decimal values to hex. */ | |
var NonclientMetrics = "88 1 0 0 7 0 0 0 17 0 0 0 17 0 0 0 18 0 0 0 23 0 0 0 240 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 188 2 0 0 1 0 0 0 0 0 5 0 85 98 117 110 116 117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 8 0 0 0 253 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 144 1 0 0 0 0 0 0 0 0 5 0 83 109 97 108 108 32 70 111 110 116 115 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 0 0 0 18 0 0 0 248 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 144 1 0 0 0 0 0 0 0 0 5 0 85 98 117 110 116 117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 244 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 188 2 0 0 1 0 0 0 0 0 5 0 85 98 117 110 116 117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 235 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 188 2 0 0 1 0 0 0 0 0 5 0 85 98 117 110 116 117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0"; | |
var IconMetrics = "76 0 0 0 122 0 0 0 46 0 0 0 1 0 0 0 247 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 144 1 0 0 0 0 0 0 0 0 5 0 85 98 117 110 116 117 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; | |
//console.log(""+NonclientMetrics.split(" ").slice(0, 88).join(" ")) | |
var ttt = IconMetrics.split(" "); | |
for(var i = 0; i < ttt.length; i++) | |
{ | |
ttt[i] = ("00"+ parseInt(ttt[i]).toString(16) ).slice(-2) | |
} | |
console.log(ttt.join(" ")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Reading NonClientMetrics and IconMetrics data in C | @bryc */ | |
#include <stdio.h> | |
#include <string.h> | |
typedef struct tagLOGFONT { | |
long lfHeight; | |
long lfWidth; | |
long lfEscapement; | |
long lfOrientation; | |
long lfWeight; | |
char lfItalic; | |
char lfUnderline; | |
char lfStrikeOut; | |
char lfCharSet; | |
char lfOutPrecision; | |
char lfClipPrecision; | |
char lfQuality; | |
char lfPitchAndFamily; | |
char lfFaceName[32]; | |
} LOGFONT; | |
typedef struct tagICONMETRICS { | |
long cbSize; | |
long iHorzSpacing; | |
long iVertSpacing; | |
long iTitleWrap; | |
LOGFONT lfFont; | |
} ICONMETRICS; | |
typedef struct tagNONCLIENTMETRICS { | |
long cbSize; | |
long iBorderWidth; | |
long iScrollWidth; | |
long iScrollHeight; | |
long iCaptionWidth; | |
long iCaptionHeight; | |
LOGFONT lfCaptionFont; | |
long iSmCaptionWidth; | |
long iSmCaptionHeight; | |
LOGFONT lfSmCaptionFont; | |
long iMenuWidth; | |
long iMenuHeight; | |
LOGFONT lfMenuFont; | |
LOGFONT lfStatusFont; | |
LOGFONT lfMessageFont; | |
long iPaddedBorderWidth; | |
} NONCLIENTMETRICS; | |
int displayData(NONCLIENTMETRICS data) { | |
printf("cbSize %d \n", data.cbSize); | |
printf("iBorderWidth %d \n", data.iBorderWidth); | |
printf("iScrollWidth %d \n", data.iScrollWidth); | |
printf("iScrollHeight %d \n", data.iScrollHeight); | |
printf("iCaptionWidth %d \n", data.iCaptionWidth); | |
printf("iCaptionHeight %d \n\n", data.iCaptionHeight); | |
printf("lfCaptionFont\n"); | |
printf(" lfHeight %d\n" , data.lfCaptionFont.lfHeight); | |
printf(" lfWidth %d\n" , data.lfCaptionFont.lfWidth); | |
printf(" lfEscapement %d\n" , data.lfCaptionFont.lfEscapement); | |
printf(" lfOrientation %d\n" , data.lfCaptionFont.lfOrientation); | |
printf(" lfWeight %d\n" , data.lfCaptionFont.lfWeight); | |
printf(" lfItalic %d\n" , data.lfCaptionFont.lfItalic); | |
printf(" lfUnderline %d\n" , data.lfCaptionFont.lfUnderline); | |
printf(" lfStrikeOut %d\n" , data.lfCaptionFont.lfStrikeOut); | |
printf(" lfCharSet %d\n" , data.lfCaptionFont.lfCharSet); | |
printf(" lfOutPrecision %d\n" , data.lfCaptionFont.lfOutPrecision); | |
printf(" lfClipPrecision %d\n" , data.lfCaptionFont.lfClipPrecision); | |
printf(" lfQuality %d\n" , data.lfCaptionFont.lfQuality); | |
printf(" lfPitchAndFamily %d\n" , data.lfCaptionFont.lfPitchAndFamily); | |
printf(" lfFaceName %s\n\n" , data.lfCaptionFont.lfFaceName); | |
printf("iSmCaptionWidth %d \n", data.iSmCaptionWidth); | |
printf("iSmCaptionHeight %d \n\n", data.iSmCaptionHeight); | |
printf("lfSmCaptionFont\n"); | |
printf(" lfHeight %d\n" , data.lfSmCaptionFont.lfHeight); | |
printf(" lfWidth %d\n" , data.lfSmCaptionFont.lfWidth); | |
printf(" lfEscapement %d\n" , data.lfSmCaptionFont.lfEscapement); | |
printf(" lfOrientation %d\n" , data.lfSmCaptionFont.lfOrientation); | |
printf(" lfWeight %d\n" , data.lfSmCaptionFont.lfWeight); | |
printf(" lfItalic %d\n" , data.lfSmCaptionFont.lfItalic); | |
printf(" lfUnderline %d\n" , data.lfSmCaptionFont.lfUnderline); | |
printf(" lfStrikeOut %d\n" , data.lfSmCaptionFont.lfStrikeOut); | |
printf(" lfCharSet %d\n" , data.lfSmCaptionFont.lfCharSet); | |
printf(" lfOutPrecision %d\n" , data.lfSmCaptionFont.lfOutPrecision); | |
printf(" lfClipPrecision %d\n" , data.lfSmCaptionFont.lfClipPrecision); | |
printf(" lfQuality %d\n" , data.lfSmCaptionFont.lfQuality); | |
printf(" lfPitchAndFamily %d\n" , data.lfSmCaptionFont.lfPitchAndFamily); | |
printf(" lfFaceName %s\n\n" , data.lfSmCaptionFont.lfFaceName); | |
printf("iMenuWidth %d \n", data.iMenuWidth); | |
printf("iMenuHeight %d \n\n", data.iMenuHeight); | |
printf("lfMenuFont\n"); | |
printf(" lfHeight %d\n" , data.lfMenuFont.lfHeight); | |
printf(" lfWidth %d\n" , data.lfMenuFont.lfWidth); | |
printf(" lfEscapement %d\n" , data.lfMenuFont.lfEscapement); | |
printf(" lfOrientation %d\n" , data.lfMenuFont.lfOrientation); | |
printf(" lfWeight %d\n" , data.lfMenuFont.lfWeight); | |
printf(" lfItalic %d\n" , data.lfMenuFont.lfItalic); | |
printf(" lfUnderline %d\n" , data.lfMenuFont.lfUnderline); | |
printf(" lfStrikeOut %d\n" , data.lfMenuFont.lfStrikeOut); | |
printf(" lfCharSet %d\n" , data.lfMenuFont.lfCharSet); | |
printf(" lfOutPrecision %d\n" , data.lfMenuFont.lfOutPrecision); | |
printf(" lfClipPrecision %d\n" , data.lfMenuFont.lfClipPrecision); | |
printf(" lfQuality %d\n" , data.lfMenuFont.lfQuality); | |
printf(" lfPitchAndFamily %d\n" , data.lfMenuFont.lfPitchAndFamily); | |
printf(" lfFaceName %s\n\n" , data.lfMenuFont.lfFaceName); | |
printf("lfStatusFont\n"); | |
printf(" lfHeight %d\n" , data.lfStatusFont.lfHeight); | |
printf(" lfWidth %d\n" , data.lfStatusFont.lfWidth); | |
printf(" lfEscapement %d\n" , data.lfStatusFont.lfEscapement); | |
printf(" lfOrientation %d\n" , data.lfStatusFont.lfOrientation); | |
printf(" lfWeight %d\n" , data.lfStatusFont.lfWeight); | |
printf(" lfItalic %d\n" , data.lfStatusFont.lfItalic); | |
printf(" lfUnderline %d\n" , data.lfStatusFont.lfUnderline); | |
printf(" lfStrikeOut %d\n" , data.lfStatusFont.lfStrikeOut); | |
printf(" lfCharSet %d\n" , data.lfStatusFont.lfCharSet); | |
printf(" lfOutPrecision %d\n" , data.lfStatusFont.lfOutPrecision); | |
printf(" lfClipPrecision %d\n" , data.lfStatusFont.lfClipPrecision); | |
printf(" lfQuality %d\n" , data.lfStatusFont.lfQuality); | |
printf(" lfPitchAndFamily %d\n" , data.lfStatusFont.lfPitchAndFamily); | |
printf(" lfFaceName %s\n\n" , data.lfStatusFont.lfFaceName); | |
printf("lfMessageFont\n"); | |
printf(" lfHeight %d\n" , data.lfMessageFont.lfHeight); | |
printf(" lfWidth %d\n" , data.lfMessageFont.lfWidth); | |
printf(" lfEscapement %d\n" , data.lfMessageFont.lfEscapement); | |
printf(" lfOrientation %d\n" , data.lfMessageFont.lfOrientation); | |
printf(" lfWeight %d\n" , data.lfMessageFont.lfWeight); | |
printf(" lfItalic %d\n" , data.lfMessageFont.lfItalic); | |
printf(" lfUnderline %d\n" , data.lfMessageFont.lfUnderline); | |
printf(" lfStrikeOut %d\n" , data.lfMessageFont.lfStrikeOut); | |
printf(" lfCharSet %d\n" , data.lfMessageFont.lfCharSet); | |
printf(" lfOutPrecision %d\n" , data.lfMessageFont.lfOutPrecision); | |
printf(" lfClipPrecision %d\n" , data.lfMessageFont.lfClipPrecision); | |
printf(" lfQuality %d\n" , data.lfMessageFont.lfQuality); | |
printf(" lfPitchAndFamily %d\n" , data.lfMessageFont.lfPitchAndFamily); | |
printf(" lfFaceName %s\n" , data.lfMessageFont.lfFaceName); | |
printf("iPaddedBorderWidth %d \n", data.iPaddedBorderWidth); | |
return 1; | |
} | |
int main() { | |
FILE *fp = fopen("DATA.bin", "rb"); | |
if(fp) { | |
NONCLIENTMETRICS data; | |
fread(&data, sizeof(data), 1, fp); | |
fclose(fp); | |
displayData(data); | |
} else { | |
printf("ERROR: Can't open file\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment