Skip to content

Instantly share code, notes, and snippets.

Krzysztof Kowalczyk kjk

Block or report user

Report or block kjk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kjk / sumatra checkbox tree.txt
Created Dec 31, 2019
Sumatra checkbox in tree view (made with
View sumatra checkbox tree.txt
typedef struct tagTVITEMCHANGE {
NMHDR hdr;
UINT uChanged;
UINT uStateNew;
View main.txt
#if(WINVER >= 0x0601)
#define WM_GESTURE 0x0119
#endif /* WINVER >= 0x0601 */
#if (_WIN32_WINNT >= 0x0600)
#define WM_MOUSEHWHEEL 0x020E
#include <cstdio>
void foo(int); // Prototype declaration of foo, seen by main
// Must specify return type, name, and argument list types
int main()
foo(2); // OK: foo is known, called even though its body is not yet defined
// Must match the prototype
// declare 'foo' function first
void foo(int x) {}
int main()
// OK: 'foo' has been defined, so it can be called here.
int main()
// error: foo is called, but has not yet been declared
// this definition is not known in main
void foo(int x)
kjk / sumatra refactor.txt
Last active Dec 21, 2019
Sumatra refactors (made with
View sumatra refactor.txt
* test DjVu for links / destination
* test Chm for links / destination
* test ebook for links / images (newImageDataElement())
* extend automated tests to test PageDestination / PageElement (run all files and dump toc tree and elements or use engine dump and a Go program to drive it)
kjk / main.cpp
Created Dec 11, 2019
sumatra SaveFileAsPDF (made with
View main.cpp
bool ImageEngineImpl::SaveFileAsPDF(const char* pdfFileName, bool includeUserAnnots) {
bool ok = true;
PdfCreator* c = new PdfCreator();
if (FileName()) {
OwnedData data(file::ReadFile(FileName()));
ok = && c->AddImagePage(, data.size, GetFileDPI());
} else {
auto [data, size] = GetDataFromStream(fileStream, nullptr);
ok = data && c->AddImagePage(data, size, GetFileDPI());
View sumatra asan unrar crash.txt
--- C:\Users\kjk\src\sumatrapdf\ext\unrar\arcread.cpp --------------------------
00EA1A50 push ebp
00EA1A51 mov ebp,esp
00EA1A53 and esp,0FFFFFFE0h
00EA1A56 sub esp,18h
// Once we failed to decrypt an encrypted block, there is no reason to
// attempt to do it further. We'll never be successful and only generate
// endless errors.
if (FailedHeaderDecryption)
00EA1A59 lea edx,[ecx+7DF5h]
kjk / asan crash in SHGetFileInfo.txt
Last active Dec 7, 2019
msvc asasn crash in SHGetFileInfoW (made with
View asan crash in SHGetFileInfo.txt
This happened on Win 10. Testing x32 asan build of SumatraPDf.
==10996==ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x028f04f8
#0 0x11e502e in __asan_wrap_HeapSize D:\agent\_work\6\s\src\vctools\crt\asan\llvm\compiler-rt\lib\asan\
#1 0x7629e31b in msize+0x2b (C:\WINDOWS\System32\ucrtbase.dll+0x1002e31b)
#2 0x7629e7d1 in register_onexit_function+0x231 (C:\WINDOWS\System32\ucrtbase.dll+0x1002e7d1)
#3 0x7629e68d in register_onexit_function+0xed (C:\WINDOWS\System32\ucrtbase.dll+0x1002e68d)
#4 0x7629e61c in register_onexit_function+0x7c (C:\WINDOWS\System32\ucrtbase.dll+0x1002e61c)
#5 0x7629c30f in o__register_onexit_function+0x6f (C:\WINDOWS\System32\ucrtbase.dll+0x1002c30f)
#6 0x7629c2af in o__register_onexit_function+0xf (C:\WINDOWS\System32\ucrtbase.dll+0x1002c2af)
kjk / filesize.js
Created Nov 29, 2019
human-readable file size in JavaScript (made with
View filesize.js
* filesize
* @method filesize
* @param {Mixed} arg String, Int or Float to transform
* @param {Object} descriptor [Optional] Flags
* @return {String} Readable file size String
function filesize (arg, descriptor = {}) {
You can’t perform that action at this time.