Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipfldr #451

Merged
merged 6 commits into from Apr 7, 2018
Merged

Zipfldr #451

merged 6 commits into from Apr 7, 2018

Conversation

learn-more
Copy link
Member

@learn-more learn-more commented Mar 27, 2018

Initial implementation

JIRA issue: CORE-7684

This pr aims to cleanup this code, and get it in the tree.
Further improvements will be made later on, like fixing SHCreateFileExtractIconW, implementing a toolbar that will handle IExplorerCommand etc. CORE-14175

set_cpp(WITH_RUNTIME WITH_EXCEPTIONS)
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry thomas ;)

Copy link
Member

@sanchaez sanchaez Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it? AFAIK rapps builds with this flag. It must be defined somewhere else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, some stuff doesnt build like this so we keep pushing it back.

#include <assert.h>

EXTERN_C
ULONG DbgPrint(PCSTR Format,...);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should think about moving this somewhere shared...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it already in debug.h ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boot/freeldr/freeldr/include/debug.h
That doesn't really help outside freeldr ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought it was also in sdk/include/reactos/debug.h.

return uRet;
}

#include "zlib_contrib\unzip.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slash instead of backslash?

CZipFldrModule gModule;


#include "zlib_contrib\ioapi.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

@sanchaez sanchaez self-requested a review March 28, 2018 10:27
Copy link
Contributor

@HBelusca HBelusca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any plan to put the zlib_contrib into sdk/lib/3rdparty (under the name "minizip")?

#define SFVM_GET_WEBVIEW_TASKS 84 /* undocumented */
#define SFVM_GET_WEBVIEW_THEME 86 /* undocumented */
#define SFVM_GETDEFERREDVIEWSETTINGS 92 /* undocumented */
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using some sdk/include/reactos/undocshell.h for these would be nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer apitests to be stand-alone.
When we will use this in the code, I'll move this somewhere shared.

return E_POINTER;

if (pceltFetched)
*pceltFetched = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it some kind of "FALSE"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 items fetched

private:
CComPtr<IZip> spZip;
bool first;
CAtlList<CStringA> _returned;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't use the usual "m_Blah;" notation for class members here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rename those to be consistent.


if (err < 0)
{
__debugbreak();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these debugbreaks meant to be removed in the near future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I probably should replace them with DPRINT1 before committing.

{
{ IDS_COL_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, 25, LVCFMT_LEFT },
{ IDS_COL_TYPE, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, 20, LVCFMT_LEFT },
{ IDS_COL_COMPRSIZE,SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, 10, LVCFMT_RIGHT },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/me suggests space after the first comma.

{
SHFILEINFOA shfi;
DWORD dwAttributes = isDir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
ULONG_PTR firet = SHGetFileInfoA(zipEntry->Name, dwAttributes, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_TYPENAME);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"firet"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileInfo RETurn I guess, probably copied that from somwhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileInfo-RET

STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
{
static const GUID UnknownIID = // {93F81976-6A0D-42C3-94DD-AA258A155470}
{0x93F81976, 0x6A0D, 0x42C3, {0x94, 0xDD, 0xAA, 0x25, 0x8A, 0x15, 0x54, 0x70}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no existing standard name for this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently not. I did a quick googling and no one has a name for it.

{
public:

CFolderViewCB()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is created for you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I had some code in those that is gone now.

{
private:
CComPtr<IZip> spZip;
bool first;
Copy link
Member

@sanchaez sanchaez Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bIsFirst
... but you don't use the usual MS style in this file, so whatever.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_Zip, m_First, m_Returned

:uf(NULL)
{
m_Filename = Filename;
m_Directory = m_Filename;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing those two members in initalizer list would be cleaner IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_Filename maybe, m_Directory no because I also modify it.

m_Filename = Filename;
m_Directory = m_Filename;
PWSTR Dir = m_Directory.GetBuffer();
PathRemoveExtensionW(Dir);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using rvalue from GetBuffer() would be cleaner IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree :)

m_Directory.ReleaseBuffer();
}

~CZipExtract()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is created for you. Maybe you wanted virtual dtor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I should call Close() here, and warn that it wasnt closed.

{
if (uf)
unzClose(uf);
uf = NULL;
Copy link
Member

@sanchaez sanchaez Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better IMO.

if (uf)
{
    unzClose(uf);
    uf = NULL;
}

{
case IDYES: return Yes;
case IDYESALL: return YesToAll;
default:
Copy link
Member

@sanchaez sanchaez Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird IMO but would work OK.
I would reorder the labels:

case IDCANCEL: return Cancel;
case IDNO: //return No;
default: return No;

HICON hIcon = LoadIcon(NULL, IDI_EXCLAMATION);
SendDlgItemMessage(IDC_EXCLAMATION_ICON, STM_SETICON, (WPARAM)hIcon);

/* Our CString does not support FormatMessage yet */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider implementing it then 😺

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to implement every feature that shit depends on, I can commit this in about 3 year.

}
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double newline.

@@ -0,0 +1,74 @@
MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think zlib_contrib should be moved to zlib.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean, inside our existing zlib?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being close to linux may not be bad. Some it is more easy if it's an bit more equivalent in direction linux as the "original", because later it's more easy to use with.. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackcrack: I have no idea what you are saying here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanchaez why, is there something else that needs it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since they come from the same source, keeping them together makes it easier to sync.

Copy link

@blackcrack blackcrack Apr 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@learn-more
Mark, do not mob around here otherwise I'll report you to Github.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blackcrack : I don't understand your first message either...

Copy link

@blackcrack blackcrack Apr 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is a other musik :) Okey maybe a bit Awkwardly expressed :)
i have meant , because Linux use the zlib also , i have mentored to use the zlib too.
Makes may later more usable if we use it directly.. {less complications or so.. (it was just an assumption)} ;)
And GonzoMD, it must not be bad if you it not understand ;)

@@ -400,7 +402,6 @@ HRESULT WINAPI CDefView::Initialize(IShellFolder *shellFolder)
{
m_pSFParent = shellFolder;
shellFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pSF2Parent));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I was experimenting with calls to the IShellFolderViewCB ;)

{
ok(!memcmp(colorData, colorDataRef, colorSize), "Expected equal colorData for %S(%lx)\n", cur.Name, cur.dwFlags);
/* Incase requested filetype does not match, the exe icon is not used! */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Justin Case 😆

}

{
CComPtr<IUnknown> spUnkown, spUnknown2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spUnknown

for (size_t n = 0; n < _countof(InterfaceTests); ++n)
{
{
CComPtr<IUnknown> spUnkown;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spUnknown

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

if (m_bFirst && celt)
{
m_bFirst = false;
celt--;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems redundant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah Initially I wrote this so that it could handle multiple items, to be consistent i'll leave it in.

@@ -402,6 +402,7 @@ HRESULT WINAPI CDefView::Initialize(IShellFolder *shellFolder)
{
m_pSFParent = shellFolder;
shellFolder->QueryInterface(IID_PPV_ARG(IShellFolder2, &m_pSF2Parent));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this achieve? :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It negates the removal of this line in an earlier commit.

@learn-more
Copy link
Member Author

Moved minizip to zlib/contrib, and into a static library.

@@ -21,9 +21,22 @@ list(APPEND SOURCE
infback.c
uncompr.c)

list(APPEND MINIZIP_SOURCE
Copy link
Member

@sanchaez sanchaez Apr 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe MiniZip deserves it's own CMakeLists.txt with a minizip target that could be included here via add_subdirectory()?
EDIT: refer to MiniZip Makefile or Automake/Autoconf.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding it inside an additional add_subdirectory would just be a pointless indirection.

What is there to see in the Makefile?

if(CMAKE_CROSSCOMPILING)
add_library(zlib ${SOURCE} ${SOLO_SOURCE})
add_library(zlib_solo ${SOLO_SOURCE})
add_library(minizip ${MINIZIP_SOURCE})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing dependency on xdk

@sanchaez sanchaez added the enhancement For PRs with an enhancement/new feature. label Apr 7, 2018
@learn-more learn-more self-assigned this Apr 7, 2018
@learn-more learn-more deleted the zipfldr branch April 7, 2018 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For PRs with an enhancement/new feature.
Projects
None yet
8 participants