@@ -18,22 +18,20 @@ struct CallbackContext
1818
1919struct CancelFetchDataArgs
2020{
21- std::wstring fileIdentityArg ;
21+ std::wstring pathArg ;
2222 CallbackContext *context;
2323
24- CancelFetchDataArgs (const std::wstring &fileId, CallbackContext *ctx)
25- : fileIdentityArg(fileId), context(ctx) {}
24+ CancelFetchDataArgs (const std::wstring &path, CallbackContext *ctx) : pathArg(path), context(ctx) {}
2625};
2726
2827void notify_cancel_fetch_data_call (napi_env env, napi_value js_callback, void *context, void *data)
2928{
3029 CancelFetchDataArgs *args = static_cast <CancelFetchDataArgs *>(data);
31- std::u16string u16_fileIdentity (args->fileIdentityArg .begin (), args->fileIdentityArg .end ());
3230
33- napi_value js_string ;
34- napi_create_string_utf16 (env, u16_fileIdentity .c_str (), u16_fileIdentity. size (), &js_string );
31+ napi_value js_path ;
32+ napi_create_string_utf16 (env, ( char16_t *)args-> pathArg .c_str (), args-> pathArg . length (), &js_path );
3533
36- napi_value args_to_js_callback[1 ] = {js_string };
34+ napi_value args_to_js_callback[1 ] = {js_path };
3735
3836 napi_value undefined;
3937 napi_get_undefined (env, &undefined);
@@ -50,14 +48,12 @@ void notify_cancel_fetch_data_call(napi_env env, napi_value js_callback, void *c
5048
5149void CALLBACK cancel_fetch_data_callback_wrapper (_In_ CONST CF_CALLBACK_INFO *callbackInfo, _In_ CONST CF_CALLBACK_PARAMETERS *callbackParameters)
5250{
53- LPCVOID fileIdentity = callbackInfo->FileIdentity ;
54- DWORD fileIdentityLength = callbackInfo->FileIdentityLength ;
51+ std::wstring path = std::wstring (callbackInfo->VolumeDosName ) + callbackInfo->NormalizedPath ;
5552
56- const wchar_t *wchar_ptr = static_cast <const wchar_t *>(fileIdentity);
57- std::wstring fileIdentityStr (wchar_ptr, fileIdentityLength / sizeof (wchar_t ));
53+ wprintf (L" Cancel fetch data path: %s\n " , path.c_str ());
5854
5955 CallbackContext context;
60- CancelFetchDataArgs *args = new CancelFetchDataArgs (fileIdentityStr , &context);
56+ CancelFetchDataArgs *args = new CancelFetchDataArgs (path , &context);
6157
6258 napi_call_threadsafe_function (g_cancel_fetch_data_threadsafe_callback, args, napi_tsfn_blocking);
6359
0 commit comments